From 6550021124451628b1efc60c59284465b109e3aa Mon Sep 17 00:00:00 2001 From: est31 Date: Wed, 25 Aug 2021 02:39:40 +0200 Subject: [PATCH] Remove box syntax from most places in src/test outside of the issues dir --- src/test/debuginfo/borrowed-struct.rs | 3 +- src/test/debuginfo/borrowed-tuple.rs | 3 +- src/test/debuginfo/borrowed-unique-basic.rs | 29 +++-- src/test/debuginfo/box.rs | 5 +- src/test/debuginfo/boxed-struct.rs | 17 ++- .../debuginfo/closure-in-generic-function.rs | 1 - .../debuginfo/destructured-fn-argument.rs | 3 +- .../destructured-for-loop-variable.rs | 3 +- src/test/debuginfo/destructured-local.rs | 3 +- .../generic-method-on-generic-struct.rs | 3 +- src/test/debuginfo/method-on-enum.rs | 3 +- .../debuginfo/method-on-generic-struct.rs | 4 +- src/test/debuginfo/method-on-struct.rs | 4 +- src/test/debuginfo/method-on-trait.rs | 4 +- src/test/debuginfo/method-on-tuple-struct.rs | 4 +- src/test/debuginfo/recursive-struct.rs | 58 +++++----- src/test/debuginfo/self-in-default-method.rs | 3 +- .../self-in-generic-default-method.rs | 3 +- src/test/debuginfo/trait-pointers.rs | 3 +- src/test/debuginfo/type-names.rs | 11 +- src/test/debuginfo/unique-enum.rs | 7 +- .../var-captured-in-nested-closure.rs | 3 +- .../var-captured-in-sendable-closure.rs | 3 +- .../var-captured-in-stack-closure.rs | 3 +- .../auxiliary/issue-40001-plugin.rs | 4 +- .../auxiliary/lint-for-crate-rpass.rs | 7 +- .../ui-fulldeps/auxiliary/lint-for-crate.rs | 3 +- .../auxiliary/lint-group-plugin-test.rs | 4 +- .../ui-fulldeps/auxiliary/lint-plugin-test.rs | 4 +- .../ui-fulldeps/auxiliary/lint-tool-test.rs | 4 +- .../auxiliary/outlive-expansion-phase.rs | 4 +- .../deriving-encodable-decodable-box.rs | 1 - src/test/ui/alignment-gep-tup-like-1.rs | 6 +- src/test/ui/array-slice-vec/vec-dst.rs | 6 +- .../ui/array-slice-vec/vector-no-ann-2.rs | 6 +- ...ciated-types-doubleendediterator-object.rs | 1 - src/test/ui/autoderef-full-lval.rs | 12 +- .../autoderef-method-on-trait.rs | 3 +- .../autoderef-method-priority.rs | 3 +- .../autoderef-method-twice-but-not-thrice.rs | 3 +- .../autoderef-method-twice.rs | 3 +- .../ui/autoref-autoderef/autoderef-method.rs | 3 +- .../autoref-intermediate-types-issue-3585.rs | 3 +- .../ui/binding/expr-match-generic-unique1.rs | 3 +- .../ui/binding/expr-match-generic-unique2.rs | 3 +- src/test/ui/binding/expr-match-unique.rs | 3 +- .../ui/binding/func-arg-incomplete-pattern.rs | 6 +- src/test/ui/binding/func-arg-ref-pattern.rs | 5 +- src/test/ui/binding/let-assignability.rs | 3 +- .../ui/binding/match-implicit-copy-unique.rs | 5 +- src/test/ui/binding/match-unique-bind.rs | 3 +- .../match-value-binding-in-guard-3291.rs | 6 +- src/test/ui/borrowck/borrow-tuple-fields.rs | 10 +- .../borrowck-bad-nested-calls-free.rs | 8 +- .../borrowck-bad-nested-calls-move.rs | 8 +- .../borrowck-borrow-from-expr-block.rs | 3 +- ...rrowck-borrow-immut-deref-of-box-as-mut.rs | 6 +- ...ck-borrow-immut-deref-of-box-as-mut.stderr | 2 +- .../borrowck/borrowck-borrowed-uniq-rvalue.rs | 8 +- .../ui/borrowck/borrowck-box-sensitivity.rs | 34 +++--- .../borrowck/borrowck-closures-mut-and-imm.rs | 10 +- .../borrowck-closures-two-mut-fail.rs | 4 +- .../ui/borrowck/borrowck-closures-two-mut.rs | 4 +- .../borrowck-closures-use-after-free.rs | 8 +- .../borrowck-closures-use-after-free.stderr | 2 +- .../borrowck-field-sensitivity-rpass.rs | 106 +++++++++--------- .../ui/borrowck/borrowck-field-sensitivity.rs | 28 ++--- .../borrowck-field-sensitivity.stderr | 2 +- ...rrowck-for-loop-correct-cmt-for-pattern.rs | 6 +- src/test/ui/borrowck/borrowck-issue-14498.rs | 20 ++-- src/test/ui/borrowck/borrowck-issue-2657-1.rs | 9 +- src/test/ui/borrowck/borrowck-issue-2657-2.rs | 6 +- src/test/ui/borrowck/borrowck-lend-flow-if.rs | 12 +- .../ui/borrowck/borrowck-lend-flow-loop.rs | 32 +++--- .../borrowck/borrowck-lend-flow-loop.stderr | 2 +- src/test/ui/borrowck/borrowck-lend-flow.rs | 8 +- .../borrowck/borrowck-loan-blocks-move-cc.rs | 8 +- .../ui/borrowck/borrowck-loan-blocks-move.rs | 8 +- .../borrowck/borrowck-loan-blocks-mut-uniq.rs | 8 +- .../borrowck-loan-blocks-mut-uniq.stderr | 2 +- .../borrowck-loan-in-overloaded-op.rs | 6 +- .../borrowck-loan-in-overloaded-op.stderr | 2 +- .../borrowck-macro-interaction-issue-6304.rs | 4 +- .../borrowck/borrowck-move-by-capture-ok.rs | 3 +- .../ui/borrowck/borrowck-move-by-capture.rs | 4 +- .../borrowck/borrowck-move-by-capture.stderr | 2 +- .../borrowck/borrowck-move-error-with-note.rs | 12 +- ...owck-move-from-subpath-of-borrowed-path.rs | 4 +- .../borrowck-move-moved-value-into-closure.rs | 6 +- ...rowck-move-moved-value-into-closure.stderr | 2 +- .../ui/borrowck/borrowck-move-subcomponent.rs | 4 +- .../ui/borrowck/borrowck-multiple-captures.rs | 16 +-- .../borrowck-multiple-captures.stderr | 6 +- src/test/ui/borrowck/borrowck-mut-uniq.rs | 3 +- .../borrowck-no-cycle-in-exchange-heap.rs | 6 +- ...borrowck-overloaded-index-move-from-vec.rs | 6 +- .../ui/borrowck/borrowck-uniq-via-lend.rs | 22 ++-- .../borrowck/borrowck-use-mut-borrow-rpass.rs | 14 +-- .../ui/borrowck/borrowck-use-mut-borrow.rs | 10 +- .../borrowck/borrowck-vec-pattern-nesting.rs | 16 +-- .../borrowck-vec-pattern-nesting.stderr | 4 +- src/test/ui/borrowck/fsu-moves-and-copies.rs | 10 +- src/test/ui/borrowck/issue-17263.rs | 6 +- .../cancel-clean-via-immediate-rvalue-ref.rs | 6 +- src/test/ui/class-cast-to-trait.rs | 6 +- src/test/ui/cleanup-arm-conditional.rs | 4 +- src/test/ui/cleanup-rvalue-scopes.rs | 5 +- ...nup-rvalue-temp-during-incomplete-alloc.rs | 4 +- src/test/ui/clone-with-exterior.rs | 4 +- src/test/ui/close-over-big-then-small-data.rs | 6 +- .../borrowck/borrowck-closures-mut-and-imm.rs | 4 +- src/test/ui/coercion/coerce-expect-unsized.rs | 1 - src/test/ui/crate-method-reexport-grrrrrrr.rs | 4 +- .../cross-crate/auxiliary/cci_nested_lib.rs | 6 +- src/test/ui/cross-crate/cci_borrow.rs | 4 +- src/test/ui/deref.rs | 4 +- src/test/ui/deriving/deriving-default-box.rs | 2 - src/test/ui/destructure-trait-ref.rs | 6 +- src/test/ui/destructure-trait-ref.stderr | 6 +- src/test/ui/drop/drop-on-empty-block-exit.rs | 4 +- src/test/ui/drop/drop-struct-as-object.rs | 4 +- src/test/ui/drop/drop-trait-enum.rs | 8 +- .../dst-trait-tuple.rs | 1 - .../ui/dynamically-sized-types/dst-tuple.rs | 3 +- src/test/ui/expr-block-generic-unique1.rs | 3 +- src/test/ui/expr-block-generic-unique2.rs | 3 +- src/test/ui/expr-block-unique.rs | 3 +- src/test/ui/expr-if-unique.rs | 4 +- src/test/ui/fn/fn-trait-formatting.rs | 10 +- src/test/ui/fn/fn-trait-formatting.stderr | 14 +-- .../cleanup-rvalue-during-if-and-while.rs | 4 +- src/test/ui/generics/generic-alias-unique.rs | 3 +- .../ui/generics/generic-exterior-unique.rs | 3 +- src/test/ui/generics/generic-fn-unique.rs | 6 +- src/test/ui/generics/generic-object.rs | 3 +- src/test/ui/generics/generic-recursive-tag.rs | 9 +- src/test/ui/generics/generic-tag.rs | 3 +- src/test/ui/generics/generic-unique.rs | 3 +- src/test/ui/infinite/infinite-autoderef.rs | 4 +- .../ui/infinite/infinite-autoderef.stderr | 11 +- src/test/ui/init-res-into-things.rs | 7 +- src/test/ui/intrinsics/intrinsic-atomics.rs | 3 +- .../ui/kindck/kindck-impl-type-params-2.rs | 6 +- src/test/ui/kindck/kindck-impl-type-params.rs | 6 +- .../ui/kindck/kindck-inherited-copy-bound.rs | 6 +- src/test/ui/last-use-is-capture.rs | 4 +- src/test/ui/leak-unique-as-tydesc.rs | 7 +- src/test/ui/lint/lint-owned-heap-memory.rs | 4 +- .../ui/lint/lint-owned-heap-memory.stderr | 4 +- ...47390-unused-variable-in-struct-pattern.rs | 4 +- src/test/ui/list.rs | 6 +- .../ui/liveness/liveness-move-call-arg.rs | 6 +- .../ui/liveness/liveness-move-call-arg.stderr | 4 +- src/test/ui/liveness/liveness-move-in-loop.rs | 6 +- .../ui/liveness/liveness-move-in-loop.stderr | 2 +- .../ui/liveness/liveness-move-in-while.rs | 6 +- .../ui/liveness/liveness-move-in-while.stderr | 2 +- .../ui/liveness/liveness-use-after-move.rs | 6 +- .../liveness/liveness-use-after-move.stderr | 3 +- src/test/ui/map-types.rs | 6 +- .../ui/methods/auxiliary/method_self_arg1.rs | 6 +- .../ui/methods/auxiliary/method_self_arg2.rs | 6 +- src/test/ui/methods/method-self-arg-aux1.rs | 4 +- src/test/ui/methods/method-self-arg-aux2.rs | 6 +- src/test/ui/methods/method-self-arg-trait.rs | 10 +- src/test/ui/methods/method-self-arg.rs | 8 +- .../method-two-trait-defer-resolution-2.rs | 4 +- src/test/ui/moves/move-1-unique.rs | 5 +- src/test/ui/moves/move-2-unique.rs | 3 +- src/test/ui/moves/move-2.rs | 3 +- src/test/ui/moves/move-3-unique.rs | 5 +- src/test/ui/moves/move-4-unique.rs | 3 +- src/test/ui/moves/move-4.rs | 3 +- src/test/ui/moves/move-arg-2-unique.rs | 5 +- src/test/ui/moves/move-arg-2.rs | 5 +- src/test/ui/moves/move-guard-same-consts.rs | 4 +- .../ui/moves/move-guard-same-consts.stderr | 2 +- src/test/ui/moves/move-in-guard-1.rs | 6 +- src/test/ui/moves/move-in-guard-1.stderr | 2 +- src/test/ui/moves/move-in-guard-2.rs | 4 +- src/test/ui/moves/move-in-guard-2.stderr | 4 +- src/test/ui/moves/move-out-of-tuple-field.rs | 8 +- .../ui/moves/moves-based-on-type-block-bad.rs | 4 +- ...type-move-out-of-closure-env-issue-1965.rs | 4 +- ...-move-out-of-closure-env-issue-1965.stderr | 2 +- .../ui/moves/moves-based-on-type-tuple.rs | 8 +- .../ui/moves/moves-based-on-type-tuple.stderr | 11 +- src/test/ui/moves/moves-sru-moved-field.rs | 8 +- src/test/ui/mut-function-arguments.rs | 6 +- src/test/ui/mut/mut-cross-borrowing.rs | 6 +- src/test/ui/new-box-syntax.rs | 11 +- src/test/ui/new-box.rs | 6 +- src/test/ui/nll/issue-52663-trait-object.rs | 6 +- .../ui/nll/issue-52663-trait-object.stderr | 4 +- src/test/ui/nullable-pointer-iotareduction.rs | 4 +- ...owned-object-borrowed-method-headerless.rs | 9 +- .../ui/objects-owned-object-owned-method.rs | 4 +- src/test/ui/occurs-check-2.rs | 6 +- src/test/ui/occurs-check-2.stderr | 11 +- src/test/ui/occurs-check.rs | 6 +- src/test/ui/occurs-check.stderr | 11 +- src/test/ui/output-slot-variants.rs | 9 +- .../ui/overloaded/overloaded-autoderef.rs | 4 +- .../overloaded/overloaded-index-autoderef.rs | 6 +- src/test/ui/panics/args-panic.rs | 4 +- src/test/ui/panics/panic-macro-any.rs | 3 +- src/test/ui/parser/trailing-plus-in-bounds.rs | 3 +- src/test/ui/pattern/usefulness/issue-12116.rs | 8 +- .../ui/pattern/usefulness/issue-12116.stderr | 4 +- src/test/ui/pattern/usefulness/issue-3601.rs | 6 +- src/test/ui/pure-sum.rs | 6 +- src/test/ui/rcvr-borrowed-to-region.rs | 3 +- src/test/ui/reachable/expr_again.rs | 2 +- src/test/ui/reachable/unreachable-arm.rs | 2 +- src/test/ui/regions/issue-12470.rs | 6 +- src/test/ui/regions/regions-borrow-at.rs | 3 +- src/test/ui/regions/regions-borrow-uniq.rs | 3 +- ...gions-close-associated-type-into-object.rs | 8 +- .../regions-close-object-into-object-1.rs | 4 +- .../regions-close-object-into-object-1.stderr | 8 +- ...ions-close-object-into-object-2.nll.stderr | 16 +-- .../regions-close-object-into-object-2.rs | 5 +- .../regions-close-object-into-object-2.stderr | 6 +- .../regions-close-object-into-object-3.rs | 4 +- .../regions-close-object-into-object-3.stderr | 8 +- ...ions-close-object-into-object-4.nll.stderr | 46 +++++--- .../regions-close-object-into-object-4.rs | 5 +- .../regions-close-object-into-object-4.stderr | 6 +- ...ions-close-object-into-object-5.nll.stderr | 36 ++++-- .../regions-close-object-into-object-5.rs | 5 +- .../regions-close-object-into-object-5.stderr | 51 ++++++--- ...ons-close-over-type-parameter-1.nll.stderr | 8 +- .../regions-close-over-type-parameter-1.rs | 10 +- ...regions-close-over-type-parameter-1.stderr | 8 +- ...se-over-type-parameter-multiple.nll.stderr | 4 +- ...ions-close-over-type-parameter-multiple.rs | 10 +- ...-close-over-type-parameter-multiple.stderr | 12 +- ...-close-over-type-parameter-successfully.rs | 4 +- .../ui/regions/regions-dependent-addr-of.rs | 3 +- .../regions-early-bound-trait-param.rs | 4 +- .../regions/regions-escape-into-other-fn.rs | 4 +- ...gions-infer-borrow-scope-within-loop-ok.rs | 3 +- .../ui/regions/regions-infer-borrow-scope.rs | 3 +- .../regions-lifetime-nonfree-late-bound.rs | 6 +- src/test/ui/regions/regions-ref-in-fn-arg.rs | 4 +- ...ions-on-closures-to-inference-variables.rs | 2 - src/test/ui/regions/regions-trait-variance.rs | 8 +- .../rfcs/rfc-2005-default-binding-mode/box.rs | 4 +- src/test/ui/self/explicit-self-generic.rs | 3 +- .../ui/self/explicit-self-objects-uniq.rs | 3 +- src/test/ui/self/explicit-self.rs | 4 +- src/test/ui/self/self-impl-2.rs | 12 +- .../self/self-in-mut-slot-default-method.rs | 3 +- src/test/ui/self/self-re-assign.rs | 3 +- src/test/ui/self/ufcs-explicit-self.rs | 9 +- src/test/ui/self/uniq-self-in-mut-slot.rs | 3 +- .../ui/shadowed/shadowed-type-parameter.rs | 2 +- src/test/ui/span/coerce-suggestions.rs | 6 +- src/test/ui/span/coerce-suggestions.stderr | 11 +- src/test/ui/span/issue-11925.rs | 4 +- .../regions-close-over-borrowed-ref-in-obj.rs | 6 +- .../regions-close-over-type-parameter-2.rs | 8 +- src/test/ui/static/static-region-bound.rs | 6 +- .../class-cast-to-trait-cross-crate-2.rs | 4 +- .../ui/structs-enums/class-separate-impl.rs | 4 +- .../enum-nullable-simplifycfg-misopt.rs | 3 +- .../sendfn-spawn-with-fn-arg.rs | 4 +- .../task-spawn-move-and-copy.rs | 4 +- src/test/ui/traits/bound/in-arc.rs | 11 +- src/test/ui/traits/coercion.rs | 1 - src/test/ui/traits/conditional-dispatch.rs | 3 +- src/test/ui/traits/issue-6128.rs | 4 +- src/test/ui/traits/kindck-owned-contains-1.rs | 6 +- .../ui/traits/object-one-type-two-traits.rs | 4 +- src/test/ui/traits/object/generics.rs | 4 +- src/test/ui/traits/test-2.rs | 7 +- src/test/ui/traits/test-2.stderr | 29 ++++- .../issue-11515-upcast-fn_mut-fn.rs | 4 +- src/test/ui/type-param-constraints.rs | 10 +- src/test/ui/typeclasses-eq-example-static.rs | 9 +- src/test/ui/typeclasses-eq-example.rs | 9 +- src/test/ui/ufcs/ufcs-explicit-self-bad.rs | 12 +- .../unboxed-closures-boxed.rs | 3 +- .../ui/uninhabited/uninhabited-patterns.rs | 2 +- src/test/ui/unique-object-noncopyable.rs | 6 +- src/test/ui/unique/unique-assign-copy.rs | 3 +- src/test/ui/unique/unique-assign-drop.rs | 6 +- src/test/ui/unique/unique-assign-generic.rs | 5 +- src/test/ui/unique/unique-assign.rs | 3 +- src/test/ui/unique/unique-autoderef-field.rs | 5 +- src/test/ui/unique/unique-autoderef-index.rs | 3 +- src/test/ui/unique/unique-cmp.rs | 13 +-- src/test/ui/unique/unique-containing-tag.rs | 8 +- src/test/ui/unique/unique-create.rs | 4 +- src/test/ui/unique/unique-decl-init-copy.rs | 3 +- src/test/ui/unique/unique-decl-init.rs | 3 +- src/test/ui/unique/unique-decl-move.rs | 3 +- src/test/ui/unique/unique-deref.rs | 3 +- src/test/ui/unique/unique-destructure.rs | 3 +- src/test/ui/unique/unique-drop-complex.rs | 4 +- src/test/ui/unique/unique-fn-arg-move.rs | 3 +- src/test/ui/unique/unique-fn-arg-mut.rs | 5 +- src/test/ui/unique/unique-fn-arg.rs | 5 +- src/test/ui/unique/unique-fn-ret.rs | 5 +- src/test/ui/unique/unique-in-tag.rs | 4 +- src/test/ui/unique/unique-in-vec-copy.rs | 3 +- src/test/ui/unique/unique-in-vec.rs | 5 +- src/test/ui/unique/unique-init.rs | 4 +- src/test/ui/unique/unique-kinds.rs | 25 ++--- src/test/ui/unique/unique-log.rs | 3 +- src/test/ui/unique/unique-move-drop.rs | 5 +- src/test/ui/unique/unique-move-temp.rs | 3 +- src/test/ui/unique/unique-move.rs | 3 +- src/test/ui/unique/unique-mutable.rs | 3 +- src/test/ui/unique/unique-object-move.rs | 4 +- src/test/ui/unique/unique-pat-2.rs | 10 +- src/test/ui/unique/unique-pat-3.rs | 17 ++- src/test/ui/unique/unique-pat.rs | 3 +- src/test/ui/unique/unique-rec.rs | 3 +- src/test/ui/unique/unique-send-2.rs | 4 +- src/test/ui/unique/unique-send.rs | 5 +- src/test/ui/unique/unique-swap.rs | 9 +- src/test/ui/unsized/unsized2.rs | 5 +- src/test/ui/unsized/unsized3-rpass.rs | 10 +- src/test/ui/unused-move-capture.rs | 4 +- src/test/ui/unused-move.rs | 6 +- src/test/ui/unwind-unique.rs | 4 +- ...use-after-move-implicity-coerced-object.rs | 8 +- ...after-move-implicity-coerced-object.stderr | 5 +- src/test/ui/use/use-after-move-self.rs | 6 +- 330 files changed, 999 insertions(+), 1193 deletions(-) diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index 7f97d96b8db93..fe945266b13ca 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -63,7 +63,6 @@ // lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5 #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -79,7 +78,7 @@ fn main() { let stack_val_interior_ref_2: &f64 = &stack_val.y; let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 }; - let unique_val: Box<_> = box SomeStruct { x: 13, y: 26.5 }; + let unique_val: Box<_> = Box::new(SomeStruct { x: 13, y: 26.5 }); let unique_val_ref: &SomeStruct = &*unique_val; let unique_val_interior_ref_1: &isize = &unique_val.x; let unique_val_interior_ref_2: &f64 = &unique_val.y; diff --git a/src/test/debuginfo/borrowed-tuple.rs b/src/test/debuginfo/borrowed-tuple.rs index be4895ef5363e..cc28e49c44745 100644 --- a/src/test/debuginfo/borrowed-tuple.rs +++ b/src/test/debuginfo/borrowed-tuple.rs @@ -37,7 +37,6 @@ #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -46,7 +45,7 @@ fn main() { let stack_val_ref: &(i16, f32) = &stack_val; let ref_to_unnamed: &(i16, f32) = &(-15, -20f32); - let unique_val: Box<(i16, f32)> = box (-17, -22f32); + let unique_val: Box<(i16, f32)> = Box::new((-17, -22f32)); let unique_val_ref: &(i16, f32) = &*unique_val; zzz(); // #break diff --git a/src/test/debuginfo/borrowed-unique-basic.rs b/src/test/debuginfo/borrowed-unique-basic.rs index f927a54f02aa6..b39f24e029e31 100644 --- a/src/test/debuginfo/borrowed-unique-basic.rs +++ b/src/test/debuginfo/borrowed-unique-basic.rs @@ -116,51 +116,50 @@ // lldbr-check:(f64) *f64_ref = 3.5 #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] fn main() { - let bool_box: Box = box true; + let bool_box: Box = Box::new(true); let bool_ref: &bool = &*bool_box; - let int_box: Box = box -1; + let int_box: Box = Box::new(-1); let int_ref: &isize = &*int_box; - let char_box: Box = box 'a'; + let char_box: Box = Box::new('a'); let char_ref: &char = &*char_box; - let i8_box: Box = box 68; + let i8_box: Box = Box::new(68); let i8_ref: &i8 = &*i8_box; - let i16_box: Box = box -16; + let i16_box: Box = Box::new(-16); let i16_ref: &i16 = &*i16_box; - let i32_box: Box = box -32; + let i32_box: Box = Box::new(-32); let i32_ref: &i32 = &*i32_box; - let i64_box: Box = box -64; + let i64_box: Box = Box::new(-64); let i64_ref: &i64 = &*i64_box; - let uint_box: Box = box 1; + let uint_box: Box = Box::new(1); let uint_ref: &usize = &*uint_box; - let u8_box: Box = box 100; + let u8_box: Box = Box::new(100); let u8_ref: &u8 = &*u8_box; - let u16_box: Box = box 16; + let u16_box: Box = Box::new(16); let u16_ref: &u16 = &*u16_box; - let u32_box: Box = box 32; + let u32_box: Box = Box::new(32); let u32_ref: &u32 = &*u32_box; - let u64_box: Box = box 64; + let u64_box: Box = Box::new(64); let u64_ref: &u64 = &*u64_box; - let f32_box: Box = box 2.5; + let f32_box: Box = Box::new(2.5); let f32_ref: &f32 = &*f32_box; - let f64_box: Box = box 3.5; + let f64_box: Box = Box::new(3.5); let f64_ref: &f64 = &*f64_box; zzz(); // #break diff --git a/src/test/debuginfo/box.rs b/src/test/debuginfo/box.rs index e443b67ebfb31..3713c8c135d2e 100644 --- a/src/test/debuginfo/box.rs +++ b/src/test/debuginfo/box.rs @@ -24,13 +24,12 @@ // lldbr-check:((i32, f64)) *b = { 0 = 2 1 = 3.5 } #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] fn main() { - let a = box 1; - let b = box (2, 3.5f64); + let a = Box::new(1); + let b = Box::new((2, 3.5f64)); zzz(); // #break } diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index 155088c61fe31..64bc124756d6d 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -28,7 +28,6 @@ // lldbr-check:(boxed_struct::StructWithDestructor) *boxed_with_dtor = { x = 77 y = 777 z = 7777 w = 77777 } #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -52,9 +51,19 @@ impl Drop for StructWithDestructor { fn main() { - let boxed_with_padding: Box<_> = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }; - - let boxed_with_dtor: Box<_> = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }; + let boxed_with_padding: Box<_> = Box::new(StructWithSomePadding { + x: 99, + y: 999, + z: 9999, + w: 99999, + }); + + let boxed_with_dtor: Box<_> = Box::new(StructWithDestructor { + x: 77, + y: 777, + z: 7777, + w: 77777, + }); zzz(); // #break } diff --git a/src/test/debuginfo/closure-in-generic-function.rs b/src/test/debuginfo/closure-in-generic-function.rs index 239055b3a78b6..91d7ddc5416d8 100644 --- a/src/test/debuginfo/closure-in-generic-function.rs +++ b/src/test/debuginfo/closure-in-generic-function.rs @@ -39,7 +39,6 @@ // lldbr-check:(i32) *y = 110 // lldb-command:continue -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] diff --git a/src/test/debuginfo/destructured-fn-argument.rs b/src/test/debuginfo/destructured-fn-argument.rs index a776f51907158..9cd3874a5dfb7 100644 --- a/src/test/debuginfo/destructured-fn-argument.rs +++ b/src/test/debuginfo/destructured-fn-argument.rs @@ -358,7 +358,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -480,7 +479,7 @@ fn main() { managed_box(&(34, 35)); borrowed_pointer(&(36, 37)); contained_borrowed_pointer((&38, 39)); - unique_pointer(box (40, 41, 42)); + unique_pointer(Box::new((40, 41, 42))); ref_binding((43, 44, 45)); ref_binding_in_tuple((46, (47, 48))); ref_binding_in_struct(Struct { a: 49, b: 50 }); diff --git a/src/test/debuginfo/destructured-for-loop-variable.rs b/src/test/debuginfo/destructured-for-loop-variable.rs index 1532c83dfac3a..15cb88ef25d5b 100644 --- a/src/test/debuginfo/destructured-for-loop-variable.rs +++ b/src/test/debuginfo/destructured-for-loop-variable.rs @@ -173,7 +173,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -214,7 +213,7 @@ fn main() { y: -300001.5, z: true }, - box 854237.5); + Box::new(854237.5)); for &(v1, &Struct { x: x1, y: ref y1, z: z1 }, diff --git a/src/test/debuginfo/destructured-local.rs b/src/test/debuginfo/destructured-local.rs index 712168b5baa87..3a2a889777ea0 100644 --- a/src/test/debuginfo/destructured-local.rs +++ b/src/test/debuginfo/destructured-local.rs @@ -285,7 +285,6 @@ #![allow(unused_variables)] #![feature(box_patterns)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -345,7 +344,7 @@ fn main() { let (&cc, _) = (&38, 39); // unique pointer - let box dd = box (40, 41, 42); + let box dd = Box::new((40, 41, 42)); // ref binding let ref ee = (43, 44, 45); diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs index 85fe8ac08f3c4..97609ef5d9341 100644 --- a/src/test/debuginfo/generic-method-on-generic-struct.rs +++ b/src/test/debuginfo/generic-method-on-generic-struct.rs @@ -123,7 +123,6 @@ // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -155,7 +154,7 @@ fn main() { let _ = stack.self_by_ref(-1, 2_u16); let _ = stack.self_by_val(-3, -4_i16); - let owned: Box<_> = box Struct { x: 1234.5f64 }; + let owned: Box<_> = Box::new(Struct { x: 1234.5f64 }); let _ = owned.self_by_ref(-5, -6_i32); let _ = owned.self_by_val(-7, -8_i64); let _ = owned.self_owned(-9, -10.5_f32); diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs index 80f4c2e1150ec..aaa9bd9d6f97a 100644 --- a/src/test/debuginfo/method-on-enum.rs +++ b/src/test/debuginfo/method-on-enum.rs @@ -107,7 +107,6 @@ // lldb-check:[...]$14 = -10 // lldb-command:continue -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -140,7 +139,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned: Box<_> = box Enum::Variant1{ x: 1799, y: 1799 }; + let owned: Box<_> = Box::new(Enum::Variant1{ x: 1799, y: 1799 }); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs index 80cbf7430ca6e..bf047449164b0 100644 --- a/src/test/debuginfo/method-on-generic-struct.rs +++ b/src/test/debuginfo/method-on-generic-struct.rs @@ -123,8 +123,6 @@ // lldbr-check:(isize) arg2 = -10 // lldb-command:continue - -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -156,7 +154,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned: Box<_> = box Struct { x: 1234.5f64 }; + let owned: Box<_> = Box::new(Struct { x: 1234.5f64 }); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs index c764cf6832378..deed4f9cc0ad9 100644 --- a/src/test/debuginfo/method-on-struct.rs +++ b/src/test/debuginfo/method-on-struct.rs @@ -121,8 +121,6 @@ // lldbr-check:(isize) arg2 = -10 // lldb-command:continue - -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -154,7 +152,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned: Box<_> = box Struct { x: 200 }; + let owned: Box<_> = Box::new(Struct { x: 200 }); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs index 6dcf28967776f..7ebebfa72b92b 100644 --- a/src/test/debuginfo/method-on-trait.rs +++ b/src/test/debuginfo/method-on-trait.rs @@ -121,8 +121,6 @@ // lldbr-check:(isize) arg2 = -10 // lldb-command:continue - -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -160,7 +158,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned: Box<_> = box Struct { x: 200 }; + let owned: Box<_> = Box::new(Struct { x: 200 }); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs index d06b606e973e8..a5a87b2ad6f26 100644 --- a/src/test/debuginfo/method-on-tuple-struct.rs +++ b/src/test/debuginfo/method-on-tuple-struct.rs @@ -121,8 +121,6 @@ // lldbr-check:(isize) arg2 = -10 // lldb-command:continue - -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -152,7 +150,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned: Box<_> = box TupleStruct(200, -200.5); + let owned: Box<_> = Box::new(TupleStruct(200, -200.5)); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/recursive-struct.rs b/src/test/debuginfo/recursive-struct.rs index c0bd67367012f..eb14af8c588de 100644 --- a/src/test/debuginfo/recursive-struct.rs +++ b/src/test/debuginfo/recursive-struct.rs @@ -52,20 +52,20 @@ // gdb-command:print long_cycle4.value // gdb-check:$18 = 29.5 -// gdbr-command:print long_cycle_w_anonymous_types.value +// gdbr-command:print long_cycle_w_anon_types.value // gdb-check:$19 = 30 -// gdbr-command:print long_cycle_w_anonymous_types.next.val.value +// gdbr-command:print long_cycle_w_anon_types.next.val.value // gdb-check:$20 = 31 // gdb-command:continue #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] use self::Opt::{Empty, Val}; +use std::boxed::Box as B; enum Opt { Empty, @@ -120,75 +120,75 @@ struct LongCycleWithAnonymousTypes { fn main() { let stack_unique: UniqueNode = UniqueNode { next: Val { - val: box UniqueNode { + val: Box::new(UniqueNode { next: Empty, value: 1, - } + }) }, value: 0, }; - let unique_unique: Box> = box UniqueNode { + let unique_unique: Box> = Box::new(UniqueNode { next: Val { - val: box UniqueNode { + val: Box::new(UniqueNode { next: Empty, value: 3, - } + }) }, value: 2, - }; + }); let vec_unique: [UniqueNode; 1] = [UniqueNode { next: Val { - val: box UniqueNode { + val: Box::new(UniqueNode { next: Empty, value: 7.5, - } + }) }, value: 6.5, }]; let borrowed_unique: &UniqueNode = &UniqueNode { next: Val { - val: box UniqueNode { + val: Box::new(UniqueNode { next: Empty, value: 9.5, - } + }) }, value: 8.5, }; // LONG CYCLE let long_cycle1: LongCycle1 = LongCycle1 { - next: box LongCycle2 { - next: box LongCycle3 { - next: box LongCycle4 { + next: Box::new(LongCycle2 { + next: Box::new(LongCycle3 { + next: Box::new(LongCycle4 { next: None, value: 23, - }, + }), value: 22, - }, + }), value: 21 - }, + }), value: 20 }; let long_cycle2: LongCycle2 = LongCycle2 { - next: box LongCycle3 { - next: box LongCycle4 { + next: Box::new(LongCycle3 { + next: Box::new(LongCycle4 { next: None, value: 26, - }, + }), value: 25, - }, + }), value: 24 }; let long_cycle3: LongCycle3 = LongCycle3 { - next: box LongCycle4 { + next: Box::new(LongCycle4 { next: None, value: 28, - }, + }), value: 27, }; @@ -199,15 +199,15 @@ fn main() { // It's important that LongCycleWithAnonymousTypes is encountered only at the end of the // `box` chain. - let long_cycle_w_anonymous_types = box box box box box LongCycleWithAnonymousTypes { + let long_cycle_w_anon_types = B::new(B::new(B::new(B::new(B::new(LongCycleWithAnonymousTypes { next: Val { - val: box box box box box LongCycleWithAnonymousTypes { + val: Box::new(Box::new(Box::new(Box::new(Box::new(LongCycleWithAnonymousTypes { next: Empty, value: 31, - } + }))))) }, value: 30 - }; + }))))); zzz(); // #break } diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs index e15c08577e15a..b8b5add0996aa 100644 --- a/src/test/debuginfo/self-in-default-method.rs +++ b/src/test/debuginfo/self-in-default-method.rs @@ -121,7 +121,6 @@ // lldbr-check:(isize) arg2 = -10 // lldb-command:continue -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -154,7 +153,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned: Box<_> = box Struct { x: 200 }; + let owned: Box<_> = Box::new(Struct { x: 200 }); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs index 7634e3247d591..efce449e312ed 100644 --- a/src/test/debuginfo/self-in-generic-default-method.rs +++ b/src/test/debuginfo/self-in-generic-default-method.rs @@ -121,7 +121,6 @@ // lldbr-check:(f32) arg2 = -10.5 // lldb-command:continue -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -155,7 +154,7 @@ fn main() { let _ = stack.self_by_ref(-1, 2_u16); let _ = stack.self_by_val(-3, -4_i16); - let owned: Box<_> = box Struct { x: 879 }; + let owned: Box<_> = Box::new(Struct { x: 879 }); let _ = owned.self_by_ref(-5, -6_i32); let _ = owned.self_by_val(-7, -8_i64); let _ = owned.self_owned(-9, -10.5_f32); diff --git a/src/test/debuginfo/trait-pointers.rs b/src/test/debuginfo/trait-pointers.rs index a44f30abd6859..e12daaf114e14 100644 --- a/src/test/debuginfo/trait-pointers.rs +++ b/src/test/debuginfo/trait-pointers.rs @@ -5,7 +5,6 @@ // lldb-command:run #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -24,5 +23,5 @@ impl Trait for Struct {} fn main() { let stack_struct = Struct { a:0, b: 1.0 }; let reference: &Trait = &stack_struct as &Trait; - let unique: Box = box Struct { a:2, b: 3.0 } as Box; + let unique: Box = Box::new(Struct { a:2, b: 3.0 }) as Box; } diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index 3497f0afb2cb0..2c10360fc924e 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -262,7 +262,6 @@ // cdb-check:struct ForeignType2 * foreign2 = [...] // cdb-check:struct ForeignType1 * foreign1 = [...] -#![feature(box_syntax)] #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -373,8 +372,8 @@ fn main() { let tuple2 = ((Struct1, mod1::mod2::Struct3), mod1::Variant1, 'x'); // Box - let box1 = (box 1f32, 0i32); - let box2 = (box mod1::mod2::Variant2(1f32), 0i32); + let box1 = (Box::new(1f32), 0i32); + let box2 = (Box::new(mod1::mod2::Variant2(1f32)), 0i32); // References let ref1 = (&Struct1, 0i32); @@ -404,14 +403,14 @@ fn main() { let slice2 = &*vec2; // Trait Objects - let box_trait = (box 0_isize) as Box; + let box_trait = Box::new(0_isize) as Box; let ref_trait = &0_isize as &dyn Trait1; let mut mut_int1 = 0_isize; let mut_ref_trait = (&mut mut_int1) as &mut dyn Trait1; - let no_principal_trait = (box 0_isize) as Box<(dyn Send + Sync)>; + let no_principal_trait = Box::new(0_isize) as Box<(dyn Send + Sync)>; let has_associated_type_trait = &0_isize as &(dyn Trait3 + Send); - let generic_box_trait = (box 0_isize) as Box>; + let generic_box_trait = Box::new(0_isize) as Box>; let generic_ref_trait = (&0_isize) as &dyn Trait2; let mut generic_mut_ref_trait_impl = 0_isize; diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index 9d938b6e36919..d7dfaeefe2b77 100644 --- a/src/test/debuginfo/unique-enum.rs +++ b/src/test/debuginfo/unique-enum.rs @@ -32,7 +32,6 @@ // lldbr-check:(unique_enum::Univariant) *univariant = { TheOnlyCase = { = 123234 } } #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -59,15 +58,15 @@ fn main() { // 0b01111100011111000111110001111100 = 2088533116 // 0b0111110001111100 = 31868 // 0b01111100 = 124 - let the_a: Box<_> = box ABC::TheA { x: 0, y: 8970181431921507452 }; + let the_a: Box<_> = Box::new(ABC::TheA { x: 0, y: 8970181431921507452 }); // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441 // 0b00010001000100010001000100010001 = 286331153 // 0b0001000100010001 = 4369 // 0b00010001 = 17 - let the_b: Box<_> = box ABC::TheB (0, 286331153, 286331153); + let the_b: Box<_> = Box::new(ABC::TheB (0, 286331153, 286331153)); - let univariant: Box<_> = box Univariant::TheOnlyCase(123234); + let univariant: Box<_> = Box::new(Univariant::TheOnlyCase(123234)); zzz(); // #break } diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index a2778fc6090d2..d811915c38767 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -133,7 +133,6 @@ // cdb-check:closure_local : 8 [Type: [...]] #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -154,7 +153,7 @@ fn main() { }; let struct_ref = &a_struct; - let owned: Box<_> = box 6; + let owned: Box<_> = Box::new(6); let mut closure = || { let closure_local = 8; diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index bd7c2bfe2c3ff..39930e04e4c5f 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -34,7 +34,6 @@ // lldbr-check:(isize) *owned = 5 #![allow(unused_variables)] -#![feature(box_syntax)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -53,7 +52,7 @@ fn main() { c: 4 }; - let owned: Box<_> = box 5; + let owned: Box<_> = Box::new(5); let closure = move || { zzz(); // #break diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index 1bbb79c37a4e7..d68409a9d5205 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -115,7 +115,6 @@ // cdb-command: dx owned // cdb-check:owned : 0x[...] : 6 [Type: [...] *] -#![feature(box_syntax)] #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] @@ -137,7 +136,7 @@ fn main() { }; let struct_ref = &a_struct; - let owned: Box<_> = box 6; + let owned: Box<_> = Box::new(6); { let mut first_closure = || { diff --git a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs index 0b68d5e04f7a2..8051c58898e49 100644 --- a/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs +++ b/src/test/ui-fulldeps/auxiliary/issue-40001-plugin.rs @@ -1,4 +1,4 @@ -#![feature(box_syntax, plugin, rustc_private)] +#![feature(plugin, rustc_private)] #![crate_type = "dylib"] extern crate rustc_ast_pretty; @@ -21,7 +21,7 @@ use rustc_span::source_map; #[no_mangle] fn __rustc_plugin_registrar(reg: &mut Registry) { reg.lint_store.register_lints(&[&MISSING_ALLOWED_ATTR]); - reg.lint_store.register_late_pass(|| box MissingAllowedAttrPass); + reg.lint_store.register_late_pass(|| Box::new(MissingAllowedAttrPass)); } declare_lint! { diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs index 0015a826126ff..fc57c14ec32b1 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs @@ -1,7 +1,6 @@ // force-host #![feature(rustc_private)] -#![feature(box_syntax)] extern crate rustc_driver; extern crate rustc_hir; @@ -73,7 +72,7 @@ fn __rustc_plugin_registrar(reg: &mut Registry) { &CRATE_NOT_GREY, &CRATE_NOT_GREEN, ]); - reg.lint_store.register_late_pass(|| box PassOkay); - reg.lint_store.register_late_pass(|| box PassRedBlue); - reg.lint_store.register_late_pass(|| box PassGreyGreen); + reg.lint_store.register_late_pass(|| Box::new(PassOkay)); + reg.lint_store.register_late_pass(|| Box::new(PassRedBlue)); + reg.lint_store.register_late_pass(|| Box::new(PassGreyGreen)); } diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs index 87c90b53648c7..78c6c7ed887a9 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate.rs @@ -1,7 +1,6 @@ // force-host #![feature(rustc_private)] -#![feature(box_syntax)] extern crate rustc_driver; extern crate rustc_hir; @@ -41,5 +40,5 @@ impl<'tcx> LateLintPass<'tcx> for Pass { #[no_mangle] fn __rustc_plugin_registrar(reg: &mut Registry) { reg.lint_store.register_lints(&[&CRATE_NOT_OKAY]); - reg.lint_store.register_late_pass(|| box Pass); + reg.lint_store.register_late_pass(|| Box::new(Pass)); } diff --git a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs index f6ae560411b8e..253855fd2edd4 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-group-plugin-test.rs @@ -1,6 +1,6 @@ // force-host -#![feature(box_syntax, rustc_private)] +#![feature(rustc_private)] // Load rustc as a plugin to get macros. extern crate rustc_driver; @@ -36,7 +36,7 @@ impl<'tcx> LateLintPass<'tcx> for Pass { #[no_mangle] fn __rustc_plugin_registrar(reg: &mut Registry) { reg.lint_store.register_lints(&[&TEST_LINT, &PLEASE_LINT]); - reg.lint_store.register_late_pass(|| box Pass); + reg.lint_store.register_late_pass(|| Box::new(Pass)); reg.lint_store.register_group( true, "lint_me", diff --git a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs index 32326bc8a5e50..42368ec36a028 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs @@ -1,6 +1,6 @@ // force-host -#![feature(box_syntax, rustc_private)] +#![feature(rustc_private)] extern crate rustc_ast; @@ -31,5 +31,5 @@ impl EarlyLintPass for Pass { #[no_mangle] fn __rustc_plugin_registrar(reg: &mut Registry) { reg.lint_store.register_lints(&[&TEST_LINT]); - reg.lint_store.register_early_pass(|| box Pass); + reg.lint_store.register_early_pass(|| Box::new(Pass)); } diff --git a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs index 42c1c851de823..81feddf571323 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-tool-test.rs @@ -1,4 +1,4 @@ -#![feature(box_syntax, rustc_private)] +#![feature(rustc_private)] extern crate rustc_ast; @@ -46,7 +46,7 @@ impl EarlyLintPass for Pass { #[no_mangle] fn __rustc_plugin_registrar(reg: &mut Registry) { reg.lint_store.register_lints(&[&TEST_RUSTC_TOOL_LINT, &TEST_LINT, &TEST_GROUP]); - reg.lint_store.register_early_pass(|| box Pass); + reg.lint_store.register_early_pass(|| Box::new(Pass)); reg.lint_store.register_group( true, "clippy::group", diff --git a/src/test/ui-fulldeps/auxiliary/outlive-expansion-phase.rs b/src/test/ui-fulldeps/auxiliary/outlive-expansion-phase.rs index d0eedf23cafe9..e83dfe80463d8 100644 --- a/src/test/ui-fulldeps/auxiliary/outlive-expansion-phase.rs +++ b/src/test/ui-fulldeps/auxiliary/outlive-expansion-phase.rs @@ -1,6 +1,6 @@ // force-host -#![feature(box_syntax, rustc_private)] +#![feature(rustc_private)] extern crate rustc_middle; extern crate rustc_driver; @@ -20,5 +20,5 @@ impl Drop for Foo { #[no_mangle] fn __rustc_plugin_registrar(_: &mut Registry) { thread_local!(static FOO: RefCell>> = RefCell::new(None)); - FOO.with(|s| *s.borrow_mut() = Some(box Foo { foo: 10 } as Box)); + FOO.with(|s| *s.borrow_mut() = Some(Box::new(Foo { foo: 10 }) as Box)); } diff --git a/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs b/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs index 119fa3d6fa8ef..fab2031d95235 100644 --- a/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs +++ b/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs @@ -1,7 +1,6 @@ // run-pass #![allow(unused_imports)] -#![feature(box_syntax)] #![feature(rustc_private)] extern crate rustc_macros; diff --git a/src/test/ui/alignment-gep-tup-like-1.rs b/src/test/ui/alignment-gep-tup-like-1.rs index adbd05ed8c175..eb503dcf3b63b 100644 --- a/src/test/ui/alignment-gep-tup-like-1.rs +++ b/src/test/ui/alignment-gep-tup-like-1.rs @@ -3,8 +3,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -#![feature(box_syntax)] - struct pair { a: A, b: B } @@ -25,10 +23,10 @@ impl Invokable for Invoker { } fn f(a: A, b: u16) -> Box+'static> { - box Invoker { + Box::new(Invoker { a: a, b: b, - } as Box+'static> + }) as Box+'static> } pub fn main() { diff --git a/src/test/ui/array-slice-vec/vec-dst.rs b/src/test/ui/array-slice-vec/vec-dst.rs index e741201652ba0..c58ddbc423946 100644 --- a/src/test/ui/array-slice-vec/vec-dst.rs +++ b/src/test/ui/array-slice-vec/vec-dst.rs @@ -1,11 +1,9 @@ // run-pass -#![feature(box_syntax)] - pub fn main() { - // Tests for indexing into box/& [T; n] + // Tests for indexing into Box<[T; n]>/& [T; n] let x: [isize; 3] = [1, 2, 3]; - let mut x: Box<[isize; 3]> = box x; + let mut x: Box<[isize; 3]> = x.into(); assert_eq!(x[0], 1); assert_eq!(x[1], 2); assert_eq!(x[2], 3); diff --git a/src/test/ui/array-slice-vec/vector-no-ann-2.rs b/src/test/ui/array-slice-vec/vector-no-ann-2.rs index dd8f402f3f6a5..e2055f551acc4 100644 --- a/src/test/ui/array-slice-vec/vector-no-ann-2.rs +++ b/src/test/ui/array-slice-vec/vector-no-ann-2.rs @@ -2,6 +2,6 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - -pub fn main() { let _quux: Box> = box Vec::new(); } +pub fn main() { + let _quux: Box> = Box::new(Vec::new()); +} diff --git a/src/test/ui/associated-types/associated-types-doubleendediterator-object.rs b/src/test/ui/associated-types/associated-types-doubleendediterator-object.rs index 96ba2ee3b62b8..05498ba63e994 100644 --- a/src/test/ui/associated-types/associated-types-doubleendediterator-object.rs +++ b/src/test/ui/associated-types/associated-types-doubleendediterator-object.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] fn pairwise_sub(mut t: Box>) -> isize { let mut result = 0; diff --git a/src/test/ui/autoderef-full-lval.rs b/src/test/ui/autoderef-full-lval.rs index f07a2c107ba45..0fadc5c98277e 100644 --- a/src/test/ui/autoderef-full-lval.rs +++ b/src/test/ui/autoderef-full-lval.rs @@ -1,23 +1,23 @@ -#![feature(box_syntax)] - struct Clam { x: Box, y: Box, } + + struct Fish { a: Box, } fn main() { - let a: Clam = Clam{x: box 1, y: box 2}; - let b: Clam = Clam{x: box 10, y: box 20}; + let a: Clam = Clam{ x: Box::new(1), y: Box::new(2) }; + let b: Clam = Clam{ x: Box::new(10), y: Box::new(20) }; let z: isize = a.x + b.y; //~^ ERROR cannot add `Box` to `Box` println!("{}", z); assert_eq!(z, 21); - let forty: Fish = Fish{a: box 40}; - let two: Fish = Fish{a: box 2}; + let forty: Fish = Fish{ a: Box::new(40) }; + let two: Fish = Fish{ a: Box::new(2) }; let answer: isize = forty.a + two.a; //~^ ERROR cannot add `Box` to `Box` println!("{}", answer); diff --git a/src/test/ui/autoref-autoderef/autoderef-method-on-trait.rs b/src/test/ui/autoref-autoderef/autoderef-method-on-trait.rs index fadb0784e7525..af747cc76e9a0 100644 --- a/src/test/ui/autoref-autoderef/autoderef-method-on-trait.rs +++ b/src/test/ui/autoref-autoderef/autoderef-method-on-trait.rs @@ -1,6 +1,5 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] trait double { fn double(self: Box) -> usize; @@ -11,6 +10,6 @@ impl double for usize { } pub fn main() { - let x: Box<_> = box (box 3usize as Box); + let x: Box<_> = Box::new(Box::new(3usize) as Box); assert_eq!(x.double(), 6); } diff --git a/src/test/ui/autoref-autoderef/autoderef-method-priority.rs b/src/test/ui/autoref-autoderef/autoderef-method-priority.rs index a218f85eba2c6..88a5140dc752b 100644 --- a/src/test/ui/autoref-autoderef/autoderef-method-priority.rs +++ b/src/test/ui/autoref-autoderef/autoderef-method-priority.rs @@ -1,6 +1,5 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] trait double { fn double(self) -> usize; @@ -15,6 +14,6 @@ impl double for Box { } pub fn main() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); assert_eq!(x.double(), 6); } diff --git a/src/test/ui/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs b/src/test/ui/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs index 9fda3b2c09999..3657e61d42534 100644 --- a/src/test/ui/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs +++ b/src/test/ui/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs @@ -1,6 +1,5 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] trait double { fn double(self: Box) -> usize; @@ -11,6 +10,6 @@ impl double for Box { } pub fn main() { - let x: Box>>>> = box box box box box 3; + let x: Box>>>> = Box::new(Box::new(Box::new(Box::new(Box::new(3))))); assert_eq!(x.double(), 6); } diff --git a/src/test/ui/autoref-autoderef/autoderef-method-twice.rs b/src/test/ui/autoref-autoderef/autoderef-method-twice.rs index f53dc8d1032bf..ed86b31b8bbed 100644 --- a/src/test/ui/autoref-autoderef/autoderef-method-twice.rs +++ b/src/test/ui/autoref-autoderef/autoderef-method-twice.rs @@ -1,6 +1,5 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] trait double { fn double(self: Box) -> usize; @@ -11,6 +10,6 @@ impl double for usize { } pub fn main() { - let x: Box> = box box 3; + let x: Box> = Box::new(Box::new(3)); assert_eq!(x.double(), 6); } diff --git a/src/test/ui/autoref-autoderef/autoderef-method.rs b/src/test/ui/autoref-autoderef/autoderef-method.rs index 262050fa47bec..5b7965e9553fe 100644 --- a/src/test/ui/autoref-autoderef/autoderef-method.rs +++ b/src/test/ui/autoref-autoderef/autoderef-method.rs @@ -1,6 +1,5 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] trait double { fn double(self: Box) -> usize; @@ -11,6 +10,6 @@ impl double for usize { } pub fn main() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); assert_eq!(x.double(), 6); } diff --git a/src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs b/src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs index 70ef7ce87ede8..3bdc248ff0f7f 100644 --- a/src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs +++ b/src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] trait Foo { fn foo(&self) -> String; @@ -18,6 +17,6 @@ impl Foo for usize { } pub fn main() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); assert_eq!(x.foo(), "box 3".to_string()); } diff --git a/src/test/ui/binding/expr-match-generic-unique1.rs b/src/test/ui/binding/expr-match-generic-unique1.rs index 5a5f75eea3679..c5f38d815593a 100644 --- a/src/test/ui/binding/expr-match-generic-unique1.rs +++ b/src/test/ui/binding/expr-match-generic-unique1.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] fn test_generic(expected: Box, eq: F) where F: FnOnce(Box, Box) -> bool { let actual: Box = match true { @@ -13,7 +12,7 @@ fn test_box() { fn compare_box(b1: Box, b2: Box) -> bool { return *b1 == *b2; } - test_generic::(box true, compare_box); + test_generic::(Box::new(true), compare_box); } pub fn main() { test_box(); } diff --git a/src/test/ui/binding/expr-match-generic-unique2.rs b/src/test/ui/binding/expr-match-generic-unique2.rs index 1d236135cdbd7..8977ca68efa67 100644 --- a/src/test/ui/binding/expr-match-generic-unique2.rs +++ b/src/test/ui/binding/expr-match-generic-unique2.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] fn test_generic(expected: T, eq: F) where F: FnOnce(T, T) -> bool { let actual: T = match true { @@ -11,7 +10,7 @@ fn test_generic(expected: T, eq: F) where F: FnOnce(T, T) -> bool { fn test_vec() { fn compare_box(v1: Box, v2: Box) -> bool { return v1 == v2; } - test_generic::, _>(box 1, compare_box); + test_generic::, _>(Box::new(1), compare_box); } pub fn main() { test_vec(); } diff --git a/src/test/ui/binding/expr-match-unique.rs b/src/test/ui/binding/expr-match-unique.rs index a999541207d14..eec9e1f8b4ae1 100644 --- a/src/test/ui/binding/expr-match-unique.rs +++ b/src/test/ui/binding/expr-match-unique.rs @@ -1,9 +1,8 @@ // 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!() }; + let res: Box<_> = match true { true => { Box::new(100) }, _ => panic!() }; assert_eq!(*res, 100); } diff --git a/src/test/ui/binding/func-arg-incomplete-pattern.rs b/src/test/ui/binding/func-arg-incomplete-pattern.rs index 98dd51811de5b..eb94ee48f9249 100644 --- a/src/test/ui/binding/func-arg-incomplete-pattern.rs +++ b/src/test/ui/binding/func-arg-incomplete-pattern.rs @@ -3,8 +3,6 @@ // 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, @@ -16,9 +14,9 @@ fn foo(Foo {x, ..}: Foo) -> *const usize { } pub fn main() { - let obj: Box<_> = box 1; + let obj: Box<_> = Box::new(1); let objptr: *const usize = &*obj; - let f = Foo {x: obj, y: box 2}; + let f = Foo { x: obj, y: Box::new(2) }; let xptr = foo(f); assert_eq!(objptr, xptr); } diff --git a/src/test/ui/binding/func-arg-ref-pattern.rs b/src/test/ui/binding/func-arg-ref-pattern.rs index f46eeb7a020d8..2d75c12140bf3 100644 --- a/src/test/ui/binding/func-arg-ref-pattern.rs +++ b/src/test/ui/binding/func-arg-ref-pattern.rs @@ -5,7 +5,6 @@ // pattern. #![feature(box_patterns)] -#![feature(box_syntax)] fn getaddr(box ref x: Box) -> *const usize { let addr: *const usize = &*x; @@ -17,11 +16,11 @@ fn checkval(box ref x: Box) -> usize { } pub fn main() { - let obj: Box<_> = box 1; + let obj: Box<_> = Box::new(1); let objptr: *const usize = &*obj; let xptr = getaddr(obj); assert_eq!(objptr, xptr); - let obj = box 22; + let obj = Box::new(22); assert_eq!(checkval(obj), 22); } diff --git a/src/test/ui/binding/let-assignability.rs b/src/test/ui/binding/let-assignability.rs index 5bb375d285d38..b85f4a96a6d50 100644 --- a/src/test/ui/binding/let-assignability.rs +++ b/src/test/ui/binding/let-assignability.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] fn f() { - let a: Box<_> = box 1; + let a: Box<_> = Box::new(1); let b: &isize = &*a; println!("{}", b); } diff --git a/src/test/ui/binding/match-implicit-copy-unique.rs b/src/test/ui/binding/match-implicit-copy-unique.rs index a7e8109b46ca7..74ffe2ecdb3a5 100644 --- a/src/test/ui/binding/match-implicit-copy-unique.rs +++ b/src/test/ui/binding/match-implicit-copy-unique.rs @@ -1,16 +1,15 @@ // 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 mut x: Box<_> = Box::new(Pair { a: Box::new(10), b: Box::new(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; + *a = Box::new(30); assert_eq!(**a, 30); } } diff --git a/src/test/ui/binding/match-unique-bind.rs b/src/test/ui/binding/match-unique-bind.rs index f5361b118bed8..507478983f681 100644 --- a/src/test/ui/binding/match-unique-bind.rs +++ b/src/test/ui/binding/match-unique-bind.rs @@ -1,9 +1,8 @@ // run-pass #![feature(box_patterns)] -#![feature(box_syntax)] pub fn main() { - match box 100 { + match Box::new(100) { box x => { println!("{}", x); assert_eq!(x, 100); diff --git a/src/test/ui/binding/match-value-binding-in-guard-3291.rs b/src/test/ui/binding/match-value-binding-in-guard-3291.rs index 4b209b20a18aa..0d750da79e71c 100644 --- a/src/test/ui/binding/match-value-binding-in-guard-3291.rs +++ b/src/test/ui/binding/match-value-binding-in-guard-3291.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - fn foo(x: Option>, b: bool) -> isize { match x { None => { 1 } @@ -12,8 +10,8 @@ fn foo(x: Option>, b: bool) -> isize { } pub fn main() { - foo(Some(box 22), true); - foo(Some(box 22), false); + foo(Some(Box::new(22)), true); + foo(Some(Box::new(22)), false); foo(None, true); foo(None, false); } diff --git a/src/test/ui/borrowck/borrow-tuple-fields.rs b/src/test/ui/borrowck/borrow-tuple-fields.rs index 3e24a1b29c920..c628fa49ede43 100644 --- a/src/test/ui/borrowck/borrow-tuple-fields.rs +++ b/src/test/ui/borrowck/borrow-tuple-fields.rs @@ -1,13 +1,13 @@ -#![feature(box_syntax)] +struct Foo(Box, isize); + +struct Bar(isize, isize); -struct Foo(Box, isize); -struct Bar(isize, isize); fn main() { - let x: (Box<_>, _) = (box 1, 2); + let x: (Box<_>, _) = (Box::new(1), 2); let r = &x.0; let y = x; //~ ERROR cannot move out of `x` because it is borrowed @@ -23,7 +23,7 @@ fn main() { let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time a.use_ref(); - let x = Foo(box 1, 2); + let x = Foo(Box::new(1), 2); let r = &x.0; let y = x; //~ ERROR cannot move out of `x` because it is borrowed r.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs index 3abc56153b78a..b0bb9a0351b49 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs @@ -1,10 +1,10 @@ // Test that we detect nested calls that could free pointers evaluated // for earlier arguments. -#![feature(box_syntax)] + fn rewrite(v: &mut Box) -> usize { - *v = box 22; + *v = Box::new(22); **v } @@ -13,7 +13,7 @@ fn add(v: &usize, w: usize) -> usize { } fn implicit() { - let mut a: Box<_> = box 1; + let mut a: Box<_> = Box::new(1); // Note the danger here: // @@ -26,7 +26,7 @@ fn implicit() { } fn explicit() { - let mut a: Box<_> = box 1; + let mut a: Box<_> = Box::new(1); add( &*a, rewrite(&mut a)); //~ ERROR cannot borrow diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs index fd8df78a5d5a1..b2afb6391c1ad 100644 --- a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs +++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs @@ -1,10 +1,10 @@ // Test that we detect nested calls that could free pointers evaluated // for earlier arguments. -#![feature(box_syntax)] + fn rewrite(v: &mut Box) -> usize { - *v = box 22; + *v = Box::new(22); **v } @@ -13,7 +13,7 @@ fn add(v: &usize, w: Box) -> usize { } fn implicit() { - let mut a: Box<_> = box 1; + let mut a: Box<_> = Box::new(1); // Note the danger here: // @@ -26,7 +26,7 @@ fn implicit() { } fn explicit() { - let mut a: Box<_> = box 1; + let mut a: Box<_> = Box::new(1); add( &*a, a); //~ ERROR cannot move diff --git a/src/test/ui/borrowck/borrowck-borrow-from-expr-block.rs b/src/test/ui/borrowck/borrowck-borrow-from-expr-block.rs index 15c6e8bf210fc..24efadc305511 100644 --- a/src/test/ui/borrowck/borrowck-borrow-from-expr-block.rs +++ b/src/test/ui/borrowck/borrowck-borrow-from-expr-block.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] fn borrow(x: &isize, f: F) where F: FnOnce(&isize) { f(x) @@ -14,5 +13,5 @@ fn test1(x: &Box) { } pub fn main() { - test1(&box 22); + test1(&Box::new(22)); } diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs index bc820ee9f9141..6b5544a8a396b 100644 --- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs +++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - struct A; impl A { @@ -7,8 +5,10 @@ impl A { } } + + pub fn main() { - let a: Box<_> = box A; + let a: Box<_> = Box::new(A); a.foo(); //~^ ERROR cannot borrow `*a` as mutable, as `a` is not declared as mutable [E0596] } diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr index 7d7e305a31f31..76dc01202f6c9 100644 --- a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr +++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr @@ -1,7 +1,7 @@ error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:12:5 | -LL | let a: Box<_> = box A; +LL | let a: Box<_> = Box::new(A); | - help: consider changing this to be mutable: `mut a` LL | a.foo(); | ^ cannot borrow as mutable diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs index a78c66f47cd14..1d05845fc6b20 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs @@ -1,8 +1,8 @@ -//buggy.rs +use std::collections::HashMap; + + -#![feature(box_syntax)] -use std::collections::HashMap; fn main() { let tmp: Box<_>; @@ -10,6 +10,6 @@ fn main() { buggy_map.insert(42, &*Box::new(1)); //~ ERROR temporary value dropped while borrowed // but it is ok if we use a temporary - tmp = box 2; + tmp = Box::new(2); buggy_map.insert(43, &*tmp); } diff --git a/src/test/ui/borrowck/borrowck-box-sensitivity.rs b/src/test/ui/borrowck/borrowck-box-sensitivity.rs index e5591f500380b..e880f876f91a9 100644 --- a/src/test/ui/borrowck/borrowck-box-sensitivity.rs +++ b/src/test/ui/borrowck/borrowck-box-sensitivity.rs @@ -3,8 +3,6 @@ // run-pass -#![feature(box_syntax)] - struct A { x: Box, y: isize, @@ -26,97 +24,97 @@ struct D { } fn copy_after_move() { - let a: Box<_> = box A { x: box 0, y: 1 }; + let a: Box<_> = Box::new(A { x: Box::new(0), y: 1 }); let _x = a.x; let _y = a.y; } fn move_after_move() { - let a: Box<_> = box B { x: box 0, y: box 1 }; + let a: Box<_> = Box::new(B { x: Box::new(0), y: Box::new(1) }); let _x = a.x; let _y = a.y; } fn borrow_after_move() { - let a: Box<_> = box A { x: box 0, y: 1 }; + let a: Box<_> = Box::new(A { x: Box::new(0), y: 1 }); let _x = a.x; let _y = &a.y; } fn move_after_borrow() { - let a: Box<_> = box B { x: box 0, y: box 1 }; + let a: Box<_> = Box::new(B { x: Box::new(0), y: Box::new(1) }); let _x = &a.x; let _y = a.y; use_imm(_x); } fn copy_after_mut_borrow() { - let mut a: Box<_> = box A { x: box 0, y: 1 }; + let mut a: Box<_> = Box::new(A { x: Box::new(0), y: 1 }); let _x = &mut a.x; let _y = a.y; use_mut(_x); } fn move_after_mut_borrow() { - let mut a: Box<_> = box B { x: box 0, y: box 1 }; + let mut a: Box<_> = Box::new(B { x: Box::new(0), y: Box::new(1) }); let _x = &mut a.x; let _y = a.y; use_mut(_x); } fn borrow_after_mut_borrow() { - let mut a: Box<_> = box A { x: box 0, y: 1 }; + let mut a: Box<_> = Box::new(A { x: Box::new(0), y: 1 }); let _x = &mut a.x; let _y = &a.y; use_mut(_x); } fn mut_borrow_after_borrow() { - let mut a: Box<_> = box A { x: box 0, y: 1 }; + let mut a: Box<_> = Box::new(A { x: Box::new(0), y: 1 }); let _x = &a.x; let _y = &mut a.y; use_imm(_x); } fn copy_after_move_nested() { - let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let a: Box<_> = Box::new(C { x: Box::new(A { x: Box::new(0), y: 1 }), y: 2 }); let _x = a.x.x; let _y = a.y; } fn move_after_move_nested() { - let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; + let a: Box<_> = Box::new(D { x: Box::new(A { x: Box::new(0), y: 1 }), y: Box::new(2) }); let _x = a.x.x; let _y = a.y; } fn borrow_after_move_nested() { - let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let a: Box<_> = Box::new(C { x: Box::new(A { x: Box::new(0), y: 1 }), y: 2 }); let _x = a.x.x; let _y = &a.y; } fn move_after_borrow_nested() { - let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; + let a: Box<_> = Box::new(D { x: Box::new(A { x: Box::new(0), y: 1 }), y: Box::new(2) }); let _x = &a.x.x; let _y = a.y; use_imm(_x); } fn copy_after_mut_borrow_nested() { - let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let mut a: Box<_> = Box::new(C { x: Box::new(A { x: Box::new(0), y: 1 }), y: 2 }); let _x = &mut a.x.x; let _y = a.y; use_mut(_x); } fn move_after_mut_borrow_nested() { - let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; + let mut a: Box<_> = Box::new(D { x: Box::new(A { x: Box::new(0), y: 1 }), y: Box::new(2) }); let _x = &mut a.x.x; let _y = a.y; use_mut(_x); } fn borrow_after_mut_borrow_nested() { - let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let mut a: Box<_> = Box::new(C { x: Box::new(A { x: Box::new(0), y: 1 }), y: 2 }); let _x = &mut a.x.x; let _y = &a.y; use_mut(_x); } fn mut_borrow_after_borrow_nested() { - let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let mut a: Box<_> = Box::new(C { x: Box::new(A { x: Box::new(0), y: 1 }), y: 2 }); let _x = &a.x.x; let _y = &mut a.y; use_imm(_x); diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs index 2dc405ffcd4c0..a8225f2faf166 100644 --- a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs +++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs @@ -1,8 +1,6 @@ // Tests that two closures cannot simultaneously have mutable // and immutable access to the variable. Issue #6801. -#![feature(box_syntax)] - fn get(x: &isize) -> isize { *x } @@ -11,6 +9,8 @@ fn set(x: &mut isize) { *x = 4; } + + fn a() { let mut x = 3; let c1 = || x = 4; @@ -52,7 +52,7 @@ fn e() { } fn f() { - let mut x: Box<_> = box 3; + let mut x: Box<_> = Box::new(3); let c1 = || get(&*x); *x = 5; //~^ ERROR cannot assign to `*x` because it is borrowed @@ -64,7 +64,7 @@ fn g() { f: Box } - let mut x: Box<_> = box Foo { f: box 3 }; + let mut x: Box<_> = Box::new(Foo { f: Box::new(3) }); let c1 = || get(&*x.f); *x.f = 5; //~^ ERROR cannot assign to `*x.f` because it is borrowed @@ -76,7 +76,7 @@ fn h() { f: Box } - let mut x: Box<_> = box Foo { f: box 3 }; + let mut x: Box<_> = Box::new(Foo { f: Box::new(3) }); let c1 = || get(&*x.f); let c2 = || *x.f = 5; //~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs index 2a1757231db85..63a75cdff42de 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs +++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs @@ -2,7 +2,7 @@ // access to the variable, whether that mutable access be used // for direct assignment or for taking mutable ref. Issue #6801. -#![feature(box_syntax)] + @@ -48,7 +48,7 @@ fn g() { f: Box } - let mut x: Box<_> = box Foo { f: box 3 }; + let mut x: Box<_> = Box::new(Foo { f: Box::new(3) }); let c1 = to_fn_mut(|| set(&mut *x.f)); let c2 = to_fn_mut(|| set(&mut *x.f)); //~^ ERROR cannot borrow `x` as mutable more than once diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut.rs b/src/test/ui/borrowck/borrowck-closures-two-mut.rs index 5fe51654f3b79..cdff8f9e890c6 100644 --- a/src/test/ui/borrowck/borrowck-closures-two-mut.rs +++ b/src/test/ui/borrowck/borrowck-closures-two-mut.rs @@ -2,7 +2,7 @@ // access to the variable, whether that mutable access be used // for direct assignment or for taking mutable ref. Issue #6801. -#![feature(box_syntax)] + fn to_fn_mut(f: F) -> F { f } @@ -44,7 +44,7 @@ fn g() { f: Box } - let mut x: Box<_> = box Foo { f: box 3 }; + let mut x: Box<_> = Box::new(Foo { f: Box::new(3) }); let c1 = to_fn_mut(|| set(&mut *x.f)); let c2 = to_fn_mut(|| set(&mut *x.f)); //~^ ERROR cannot borrow `x` as mutable more than once diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.rs b/src/test/ui/borrowck/borrowck-closures-use-after-free.rs index e9f65c4ff7df4..be5f1f873df52 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.rs +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.rs @@ -2,8 +2,6 @@ // cannot also be supplied a borrowed version of that // variable's contents. Issue #11192. -#![feature(box_syntax)] - struct Foo { x: isize } @@ -14,10 +12,12 @@ impl Drop for Foo { } } + + fn main() { - let mut ptr: Box<_> = box Foo { x: 0 }; + let mut ptr: Box<_> = Box::new(Foo { x: 0 }); let mut test = |foo: &Foo| { - ptr = box Foo { x: ptr.x + 1 }; + ptr = Box::new(Foo { x: ptr.x + 1 }); }; test(&*ptr); //~ ERROR cannot borrow `*ptr` } diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr index a6dbcf36077a7..30900a3b6d96e 100644 --- a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr +++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr @@ -3,7 +3,7 @@ error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as m | LL | let mut test = |foo: &Foo| { | ----------- mutable borrow occurs here -LL | ptr = box Foo { x: ptr.x + 1 }; +LL | ptr = Box::new(Foo { x: ptr.x + 1 }); | --- first borrow occurs due to use of `ptr` in closure LL | }; LL | test(&*ptr); diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity-rpass.rs b/src/test/ui/borrowck/borrowck-field-sensitivity-rpass.rs index cb1ba90de891e..dd6708582c1b4 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity-rpass.rs +++ b/src/test/ui/borrowck/borrowck-field-sensitivity-rpass.rs @@ -3,89 +3,87 @@ #![allow(unused_variables)] // 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 }; + let x = A { a: 1, b: Box::new(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 }; + let x = A { a: 1, b: Box::new(2) }; + let _y = A { b: Box::new(3), .. x }; drop(x.b); } fn fu_move_after_copy() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(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 x = A { a: 1, b: Box::new(2) }; + let _y = A { b: Box::new(3), .. x }; let _z = A { a: 4, .. x }; } fn copy_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); drop(x.a); } fn copy_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let y = A { a: 3, .. x }; drop(x.a); } fn fu_copy_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); - let _y = A { b: box 3, .. x }; + let _y = A { b: Box::new(3), .. x }; } fn fu_copy_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - let _z = A { b: box 3, .. x }; + let _z = A { b: Box::new(3), .. x }; } fn borrow_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); let p = &x.a; drop(*p); } fn borrow_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(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 x = A { a: 1, b: Box::new(2) }; let p = &x.a; drop(x.b); drop(*p); } fn fu_move_after_borrow() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(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 mut x = A { a: 1, b: Box::new(2) }; let p = &mut x.a; let q = &mut x.b; drop(*p); @@ -93,134 +91,134 @@ fn mut_borrow_after_mut_borrow() { } fn move_after_move() { - let x = B { a: box 1, b: box 2 }; + let x = B { a: Box::new(1), b: Box::new(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 }; + let x = B { a: Box::new(1), b: Box::new(2) }; + let y = B { a: Box::new(3), .. x }; drop(x.a); } fn fu_move_after_move() { - let x = B { a: box 1, b: box 2 }; + let x = B { a: Box::new(1), b: Box::new(2) }; drop(x.a); - let z = B { a: box 3, .. x }; + let z = B { a: Box::new(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 }; + let x = B { a: Box::new(1), b: Box::new(2) }; + let _y = B { b: Box::new(3), .. x }; + let _z = B { a: Box::new(4), .. x }; } fn copy_after_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; drop(x.b); - x = A { a: 3, b: box 4 }; + x = A { a: 3, b: Box::new(4) }; drop(*x.b); } fn copy_after_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - x = A { a: 3, b: box 4 }; + x = A { a: 3, b: Box::new(4) }; drop(*x.b); } fn copy_after_field_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; drop(x.b); - x.b = box 3; + x.b = Box::new(3); drop(*x.b); } fn copy_after_field_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - x.b = box 3; + x.b = Box::new(3); drop(*x.b); } fn borrow_after_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; drop(x.b); - x = A { a: 3, b: box 4 }; + x = A { a: 3, b: Box::new(4) }; let p = &x.b; drop(**p); } fn borrow_after_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - x = A { a: 3, b: box 4 }; + x = A { a: 3, b: Box::new(4) }; let p = &x.b; drop(**p); } fn borrow_after_field_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; drop(x.b); - x.b = box 3; + x.b = Box::new(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 mut x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - x.b = box 3; + x.b = Box::new(3); let p = &x.b; drop(**p); } fn move_after_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let _y = x.b; - x = A { a: 3, b: box 4 }; + x = A { a: 3, b: Box::new(4) }; drop(x.b); } fn move_after_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - x = A { a: 3, b: box 4 }; + x = A { a: 3, b: Box::new(4) }; drop(x.b); } fn move_after_field_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; drop(x.b); - x.b = box 3; + x.b = Box::new(3); drop(x.b); } fn move_after_field_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; - x.b = box 3; + x.b = Box::new(3); drop(x.b); } fn copy_after_assign_after_uninit() { let mut x: A; - x = A { a: 1, b: box 2 }; + x = A { a: 1, b: Box::new(2) }; drop(x.a); } fn borrow_after_assign_after_uninit() { let mut x: A; - x = A { a: 1, b: box 2 }; + x = A { a: 1, b: Box::new(2) }; let p = &x.a; drop(*p); } fn move_after_assign_after_uninit() { let mut x: A; - x = A { a: 1, b: box 2 }; + x = A { a: 1, b: Box::new(2) }; drop(x.b); } diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.rs b/src/test/ui/borrowck/borrowck-field-sensitivity.rs index ab607c2acbd4b..50edfb6ba2db1 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.rs +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.rs @@ -1,49 +1,49 @@ -#![feature(box_syntax)] - struct A { a: isize, b: Box } + + fn deref_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); drop(*x.b); //~ ERROR use of moved value: `x.b` } fn deref_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let y = A { a: 3, .. x }; drop(*x.b); //~ ERROR use of moved value: `x.b` } fn borrow_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); let p = &x.b; //~ ERROR borrow of moved value: `x.b` drop(**p); } fn borrow_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; let p = &x.b; //~ ERROR borrow of moved value: `x.b` drop(**p); } fn move_after_borrow() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let p = &x.b; drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed drop(**p); } fn fu_move_after_borrow() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let p = &x.b; let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed drop(**p); } fn mut_borrow_after_mut_borrow() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(2) }; let p = &mut x.a; let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time drop(*p); @@ -51,25 +51,25 @@ fn mut_borrow_after_mut_borrow() { } fn move_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); drop(x.b); //~ ERROR use of moved value: `x.b` } fn move_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; drop(x.b); //~ ERROR use of moved value: `x.b` } fn fu_move_after_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; drop(x.b); let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b` } fn fu_move_after_fu_move() { - let x = A { a: 1, b: box 2 }; + let x = A { a: 1, b: Box::new(2) }; let _y = A { a: 3, .. x }; let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b` } @@ -91,7 +91,7 @@ fn borrow_after_field_assign_after_uninit() { fn move_after_field_assign_after_uninit() { let mut x: A; - x.b = box 1; //~ ERROR assign to part of possibly-uninitialized variable: `x` + x.b = Box::new(1); //~ ERROR assign to part of possibly-uninitialized variable: `x` drop(x.b); } diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr index f1601336fca9b..bb4d2f06016b9 100644 --- a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr +++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr @@ -123,7 +123,7 @@ LL | x.a = 1; error[E0381]: assign to part of possibly-uninitialized variable: `x` --> $DIR/borrowck-field-sensitivity.rs:94:5 | -LL | x.b = box 1; +LL | x.b = Box::new(1); | ^^^ use of possibly-uninitialized `x` error: aborting due to 14 previous errors diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs index de75368578d9f..389b8a43c0551 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs @@ -1,6 +1,6 @@ // Issue #16205. -#![feature(box_syntax)] + struct Foo { a: [Box; 3], @@ -13,12 +13,12 @@ fn main() { } let f = Foo { - a: [box 3, box 4, box 5], + a: [Box::new(3), Box::new(4), Box::new(5)], }; for &a in &f.a { //~ ERROR cannot move out } - let x: Option> = Some(box 1); + let x: Option> = Some(Box::new(1)); for &a in x.iter() { //~ ERROR cannot move out } } diff --git a/src/test/ui/borrowck/borrowck-issue-14498.rs b/src/test/ui/borrowck/borrowck-issue-14498.rs index e8c9019264fe7..003533a51844d 100644 --- a/src/test/ui/borrowck/borrowck-issue-14498.rs +++ b/src/test/ui/borrowck/borrowck-issue-14498.rs @@ -4,14 +4,14 @@ // Also includes tests of the errors reported when the Box in question // is immutable (#14270). -#![feature(box_syntax)] + struct A { a: isize } struct B<'a> { a: Box<&'a mut isize> } fn indirect_write_to_imm_box() { let mut x: isize = 1; - let y: Box<_> = box &mut x; + let y: Box<_> = Box::new(&mut x); let p = &y; ***p = 2; //~ ERROR cannot assign to `***p` drop(p); @@ -19,7 +19,7 @@ fn indirect_write_to_imm_box() { fn borrow_in_var_from_var() { let mut x: isize = 1; - let mut y: Box<_> = box &mut x; + let mut y: Box<_> = Box::new(&mut x); let p = &y; let q = &***p; **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed @@ -29,7 +29,7 @@ fn borrow_in_var_from_var() { fn borrow_in_var_from_var_via_imm_box() { let mut x: isize = 1; - let y: Box<_> = box &mut x; + let y: Box<_> = Box::new(&mut x); let p = &y; let q = &***p; **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed @@ -39,7 +39,7 @@ fn borrow_in_var_from_var_via_imm_box() { fn borrow_in_var_from_field() { let mut x = A { a: 1 }; - let mut y: Box<_> = box &mut x.a; + let mut y: Box<_> = Box::new(&mut x.a); let p = &y; let q = &***p; **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed @@ -49,7 +49,7 @@ fn borrow_in_var_from_field() { fn borrow_in_var_from_field_via_imm_box() { let mut x = A { a: 1 }; - let y: Box<_> = box &mut x.a; + let y: Box<_> = Box::new(&mut x.a); let p = &y; let q = &***p; **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed @@ -59,7 +59,7 @@ fn borrow_in_var_from_field_via_imm_box() { fn borrow_in_field_from_var() { let mut x: isize = 1; - let mut y = B { a: box &mut x }; + let mut y = B { a: Box::new(&mut x) }; let p = &y.a; let q = &***p; **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed @@ -69,7 +69,7 @@ fn borrow_in_field_from_var() { fn borrow_in_field_from_var_via_imm_box() { let mut x: isize = 1; - let y = B { a: box &mut x }; + let y = B { a: Box::new(&mut x) }; let p = &y.a; let q = &***p; **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed @@ -79,7 +79,7 @@ fn borrow_in_field_from_var_via_imm_box() { fn borrow_in_field_from_field() { let mut x = A { a: 1 }; - let mut y = B { a: box &mut x.a }; + let mut y = B { a: Box::new(&mut x.a) }; let p = &y.a; let q = &***p; **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed @@ -89,7 +89,7 @@ fn borrow_in_field_from_field() { fn borrow_in_field_from_field_via_imm_box() { let mut x = A { a: 1 }; - let y = B { a: box &mut x.a }; + let y = B { a: Box::new(&mut x.a) }; let p = &y.a; let q = &***p; **y.a = 2; //~ ERROR cannot assign to `**y.a` because it is borrowed diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.rs b/src/test/ui/borrowck/borrowck-issue-2657-1.rs index c38293740edaa..0fb2267b982ea 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-1.rs +++ b/src/test/ui/borrowck/borrowck-issue-2657-1.rs @@ -1,9 +1,9 @@ -#![feature(box_syntax)] - +trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } +impl Fake for T { } fn main() { - let x: Option> = Some(box 1); + let x: Option> = Some(Box::new(1)); match x { Some(ref _y) => { let _a = x; //~ ERROR cannot move @@ -12,6 +12,3 @@ fn main() { _ => {} } } - -trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } } -impl Fake for T { } diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.rs b/src/test/ui/borrowck/borrowck-issue-2657-2.rs index cea5611048744..7dbac02154a6e 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.rs +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.rs @@ -1,7 +1,7 @@ -#![feature(box_syntax)] - fn main() { - let x: Option> = Some(box 1); + + let x: Option> = Some(Box::new(1)); + match x { Some(ref y) => { let _b = *y; //~ ERROR cannot move out diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.rs b/src/test/ui/borrowck/borrowck-lend-flow-if.rs index 1150346f752fa..19a0dd0c6b17b 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.rs @@ -4,7 +4,7 @@ // either genuine or would require more advanced changes. The latter // cases are noted. -#![feature(box_syntax)] + fn borrow(_v: &isize) {} fn borrow_mut(_v: &mut isize) {} @@ -13,15 +13,15 @@ fn for_func(_f: F) where F: FnOnce() -> bool { panic!() } fn produce() -> T { panic!(); } fn inc(v: &mut Box) { - *v = box (**v + 1); + *v = Box::new(**v + 1); } fn pre_freeze_cond() { // In this instance, the freeze is conditional and starts before // the mut borrow. - let u = box 0; - let mut v: Box<_> = box 3; + let u = Box::new(0); + let mut v: Box<_> = Box::new(3); let mut _w = &u; if cond() { _w = &v; @@ -34,8 +34,8 @@ fn pre_freeze_else() { // In this instance, the freeze and mut borrow are on separate sides // of the if. - let u = box 0; - let mut v: Box<_> = box 3; + let u = Box::new(0); + let mut v: Box<_> = Box::new(3); let mut _w = &u; if cond() { _w = &v; diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.rs b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs index b650df91ca23c..548ffbd515e98 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-loop.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs @@ -1,18 +1,18 @@ -#![feature(box_syntax)] - fn borrow(_v: &isize) {} fn borrow_mut(_v: &mut isize) {} fn cond() -> bool { panic!() } fn produce() -> T { panic!(); } + fn inc(v: &mut Box) { - *v = box (**v + 1); + *v = Box::new(**v + 1); } + fn loop_overarching_alias_mut() { // In this instance, the borrow ends on the line before the loop - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); let mut x = &mut v; **x += 1; loop { @@ -23,18 +23,18 @@ fn loop_overarching_alias_mut() { fn block_overarching_alias_mut() { // In this instance, the borrow encompasses the entire closure call. - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); let mut x = &mut v; for _ in 0..3 { borrow(&*v); //~ ERROR cannot borrow } - *x = box 5; + *x = Box::new(5); } fn loop_aliased_mut() { // In this instance, the borrow ends right after each assignment to _x - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let mut _x = &w; loop { borrow_mut(&mut *v); // OK @@ -45,8 +45,8 @@ fn loop_aliased_mut() { fn while_aliased_mut() { // In this instance, the borrow ends right after each assignment to _x - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let mut _x = &w; while cond() { borrow_mut(&mut *v); // OK @@ -58,8 +58,8 @@ fn while_aliased_mut() { fn loop_aliased_mut_break() { // In this instance, the borrow ends right after each assignment to _x - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let mut _x = &w; loop { borrow_mut(&mut *v); @@ -72,8 +72,8 @@ fn loop_aliased_mut_break() { fn while_aliased_mut_break() { // In this instance, the borrow ends right after each assignment to _x - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let mut _x = &w; while cond() { borrow_mut(&mut *v); @@ -84,8 +84,8 @@ fn while_aliased_mut_break() { } fn while_aliased_mut_cond(cond: bool, cond2: bool) { - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let mut x = &mut w; while cond { **x += 1; diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr index f02c357f48b4c..df7c86b85623e 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr +++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr @@ -7,7 +7,7 @@ LL | for _ in 0..3 { LL | borrow(&*v); | ^^^ immutable borrow occurs here LL | } -LL | *x = box 5; +LL | *x = Box::new(5); | -- mutable borrow later used here error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable diff --git a/src/test/ui/borrowck/borrowck-lend-flow.rs b/src/test/ui/borrowck/borrowck-lend-flow.rs index 0eb62ede5d65a..564c57044a37e 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow.rs @@ -4,7 +4,7 @@ // either genuine or would require more advanced changes. The latter // cases are noted. -#![feature(box_syntax)] + fn borrow(_v: &isize) {} fn borrow_mut(_v: &mut isize) {} @@ -13,13 +13,13 @@ fn for_func(_f: F) where F: FnOnce() -> bool { panic!() } fn produce() -> T { panic!(); } fn inc(v: &mut Box) { - *v = box (**v + 1); + *v = Box::new(**v + 1); } fn pre_freeze() { // In this instance, the freeze starts before the mut borrow. - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); let _w = &v; borrow_mut(&mut *v); //~ ERROR cannot borrow _w.use_ref(); @@ -28,7 +28,7 @@ fn pre_freeze() { fn post_freeze() { // In this instance, the const alias starts after the borrow. - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); borrow_mut(&mut *v); let _w = &v; } diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs index 9fa46563fdf80..e536d40409927 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - use std::thread; @@ -8,8 +6,10 @@ fn borrow(v: &isize, f: F) where F: FnOnce(&isize) { f(v); } + + fn box_imm() { - let v: Box<_> = box 3; + let v: Box<_> = Box::new(3); let w = &v; thread::spawn(move|| { //~^ ERROR cannot move out of `v` because it is borrowed @@ -19,7 +19,7 @@ fn box_imm() { } fn box_imm_explicit() { - let v: Box<_> = box 3; + let v: Box<_> = Box::new(3); let w = &v; thread::spawn(move|| { //~^ ERROR cannot move diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move.rs index bde73219f70ed..f3f443721b5ec 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-move.rs +++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.rs @@ -1,12 +1,12 @@ -#![feature(box_syntax)] +fn take(_v: Box) { +} + -fn take(_v: Box) { -} fn box_imm() { - let v = box 3; + let v = Box::new(3); let w = &v; take(v); //~ ERROR cannot move out of `v` because it is borrowed w.use_ref(); diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs index da30bfa29bbf7..33d6af303102a 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs @@ -1,14 +1,14 @@ -#![feature(box_syntax)] - fn borrow(v: &isize, f: F) where F: FnOnce(&isize) { f(v); } + + fn box_imm() { - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); borrow(&*v, |w| { //~ ERROR cannot borrow `v` as mutable - v = box 4; + v = Box::new(4); assert_eq!(*v, 3); assert_eq!(*w, 4); }) diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr index 1d1522a15b1ed..fa5308c290390 100644 --- a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr +++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr @@ -7,7 +7,7 @@ LL | borrow(&*v, | immutable borrow later used by call LL | |w| { | ^^^ mutable borrow occurs here -LL | v = box 4; +LL | v = Box::new(4); | - second borrow occurs due to use of `v` in closure error: aborting due to previous error diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs index 1baa94edfbe58..b8f1650fcdc59 100644 --- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs +++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs @@ -1,5 +1,5 @@ #![feature(box_patterns)] -#![feature(box_syntax)] + use std::ops::Add; @@ -12,12 +12,12 @@ impl Add for Foo { fn add(self, f: Foo) -> Foo { let Foo(box i) = self; let Foo(box j) = f; - Foo(box (i + j)) + Foo(Box::new(i + j)) } } fn main() { - let x = Foo(box 3); + let x = Foo(Box::new(3)); let _y = {x} + x.clone(); // the `{x}` forces a move to occur //~^ ERROR borrow of moved value: `x` } diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr index 095ae7f56b22e..cd288065b74f7 100644 --- a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr +++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr @@ -1,7 +1,7 @@ error[E0382]: borrow of moved value: `x` --> $DIR/borrowck-loan-in-overloaded-op.rs:21:20 | -LL | let x = Foo(box 3); +LL | let x = Foo(Box::new(3)); | - move occurs because `x` has type `Foo`, which does not implement the `Copy` trait LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur | - ^ value borrowed here after move diff --git a/src/test/ui/borrowck/borrowck-macro-interaction-issue-6304.rs b/src/test/ui/borrowck/borrowck-macro-interaction-issue-6304.rs index 628e49f574cf2..4e969f6ed83d3 100644 --- a/src/test/ui/borrowck/borrowck-macro-interaction-issue-6304.rs +++ b/src/test/ui/borrowck/borrowck-macro-interaction-issue-6304.rs @@ -6,9 +6,7 @@ // 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 @@ -23,7 +21,7 @@ impl Foo { macro_rules! declare { ($id:expr, $rest:expr) => ({ self.check_id($id); - box Bar::Bar2($id, $rest) + Box::new(Bar::Bar2($id, $rest)) }) } match s { diff --git a/src/test/ui/borrowck/borrowck-move-by-capture-ok.rs b/src/test/ui/borrowck/borrowck-move-by-capture-ok.rs index 98e4b881893cb..e7a48ebf6ca9b 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture-ok.rs +++ b/src/test/ui/borrowck/borrowck-move-by-capture-ok.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let bar: Box<_> = box 3; + let bar: Box<_> = Box::new(3); let h = || -> isize { *bar }; assert_eq!(h(), 3); } diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.rs b/src/test/ui/borrowck/borrowck-move-by-capture.rs index a825ed5e89acd..f26edef17f349 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.rs +++ b/src/test/ui/borrowck/borrowck-move-by-capture.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax,unboxed_closures)] +#![feature(unboxed_closures)] fn to_fn_mut>(f: F) -> F { f } fn to_fn_once>(f: F) -> F { f } pub fn main() { - let bar: Box<_> = box 3; + let bar: Box<_> = Box::new(3); let _g = to_fn_mut(|| { let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of }); diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.stderr index 05489cf18e7fc..257ec3fbb7fa2 100644 --- a/src/test/ui/borrowck/borrowck-move-by-capture.stderr +++ b/src/test/ui/borrowck/borrowck-move-by-capture.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of `bar`, a captured variable in an `FnMut` closure --> $DIR/borrowck-move-by-capture.rs:9:29 | -LL | let bar: Box<_> = box 3; +LL | let bar: Box<_> = Box::new(3); | --- captured outer variable LL | let _g = to_fn_mut(|| { | ________________________- diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.rs b/src/test/ui/borrowck/borrowck-move-error-with-note.rs index 7ef59f50c0332..ef38cbb63a5e3 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.rs +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.rs @@ -1,14 +1,14 @@ -#![feature(box_syntax)] - enum Foo { Foo1(Box, Box), Foo2(Box), Foo3, } + + fn blah() { - let f = &Foo::Foo1(box 1, box 2); - match *f { //~ ERROR cannot move out of + let f = &Foo::Foo1(Box::new(1), Box::new(2)); + match *f { //~ ERROR cannot move out of Foo::Foo1(num1, num2) => (), Foo::Foo2(num) => (), @@ -42,8 +42,8 @@ struct A { fn free(_: T) {} fn blah2() { - let a = &A { a: box 1 }; - match a.a { //~ ERROR cannot move out of + let a = &A { a: Box::new(1) }; + match a.a { //~ ERROR cannot move out of n => { free(n) } diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs index e058c80651679..71405f7a7329d 100644 --- a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs +++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs @@ -3,10 +3,10 @@ -#![feature(box_syntax)] + fn main() { - let a: Box> = box box 2; + let a: Box> = Box::new(Box::new(2)); let b = &a; let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs index 233d0a733e316..72e7b5a716273 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs @@ -1,11 +1,11 @@ -#![feature(box_syntax)] - fn call_f isize>(f: F) -> isize { f() } + + fn main() { - let t: Box<_> = box 3; + let t: Box<_> = Box::new(3); call_f(move|| { *t + 1 }); call_f(move|| { *t + 1 }); //~ ERROR use of moved value diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr index 1ac4999e6e11d..edd597fe30bd2 100644 --- a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr +++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `t` --> $DIR/borrowck-move-moved-value-into-closure.rs:11:12 | -LL | let t: Box<_> = box 3; +LL | let t: Box<_> = Box::new(3); | - move occurs because `t` has type `Box`, which does not implement the `Copy` trait LL | LL | call_f(move|| { *t + 1 }); diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.rs b/src/test/ui/borrowck/borrowck-move-subcomponent.rs index 4185632c4e291..38abd19322215 100644 --- a/src/test/ui/borrowck/borrowck-move-subcomponent.rs +++ b/src/test/ui/borrowck/borrowck-move-subcomponent.rs @@ -1,7 +1,7 @@ // Tests that the borrow checker checks all components of a path when moving // out. -#![feature(box_syntax)] + struct S { x : Box @@ -10,7 +10,7 @@ struct S { fn f(_: T) {} fn main() { - let a : S = S { x : box 1 }; + let a : S = S { x : Box::new(1) }; let pb = &a; let S { x: ax } = a; //~ ERROR cannot move out f(pb); diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.rs b/src/test/ui/borrowck/borrowck-multiple-captures.rs index 9f09f8442c044..57b3819ac5113 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.rs +++ b/src/test/ui/borrowck/borrowck-multiple-captures.rs @@ -1,13 +1,13 @@ -#![feature(box_syntax)] - use std::thread; + fn borrow(_: &T) { } + fn different_vars_after_borrows() { - let x1: Box<_> = box 1; + let x1: Box<_> = Box::new(1); let p1 = &x1; - let x2: Box<_> = box 2; + let x2: Box<_> = Box::new(2); let p2 = &x2; thread::spawn(move|| { //~^ ERROR cannot move out of `x1` because it is borrowed @@ -20,9 +20,9 @@ fn different_vars_after_borrows() { } fn different_vars_after_moves() { - let x1: Box<_> = box 1; + let x1: Box<_> = Box::new(1); drop(x1); - let x2: Box<_> = box 2; + let x2: Box<_> = Box::new(2); drop(x2); thread::spawn(move|| { //~^ ERROR use of moved value: `x1` @@ -33,7 +33,7 @@ fn different_vars_after_moves() { } fn same_var_after_borrow() { - let x: Box<_> = box 1; + let x: Box<_> = Box::new(1); let p = &x; thread::spawn(move|| { //~^ ERROR cannot move out of `x` because it is borrowed @@ -44,7 +44,7 @@ fn same_var_after_borrow() { } fn same_var_after_move() { - let x: Box<_> = box 1; + let x: Box<_> = Box::new(1); drop(x); thread::spawn(move|| { //~^ ERROR use of moved value: `x` diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.stderr index e159878619a0b..86d2955e2364f 100644 --- a/src/test/ui/borrowck/borrowck-multiple-captures.stderr +++ b/src/test/ui/borrowck/borrowck-multiple-captures.stderr @@ -30,7 +30,7 @@ LL | borrow(&*p2); error[E0382]: use of moved value: `x1` --> $DIR/borrowck-multiple-captures.rs:27:19 | -LL | let x1: Box<_> = box 1; +LL | let x1: Box<_> = Box::new(1); | -- move occurs because `x1` has type `Box`, which does not implement the `Copy` trait LL | drop(x1); | -- value moved here @@ -44,7 +44,7 @@ LL | drop(x1); error[E0382]: use of moved value: `x2` --> $DIR/borrowck-multiple-captures.rs:27:19 | -LL | let x2: Box<_> = box 2; +LL | let x2: Box<_> = Box::new(2); | -- move occurs because `x2` has type `Box`, which does not implement the `Copy` trait LL | drop(x2); | -- value moved here @@ -91,7 +91,7 @@ LL | drop(x); error[E0382]: use of moved value: `x` --> $DIR/borrowck-multiple-captures.rs:49:19 | -LL | let x: Box<_> = box 1; +LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait LL | drop(x); | - value moved here diff --git a/src/test/ui/borrowck/borrowck-mut-uniq.rs b/src/test/ui/borrowck/borrowck-mut-uniq.rs index 80b3484e0fb23..255b4995b640d 100644 --- a/src/test/ui/borrowck/borrowck-mut-uniq.rs +++ b/src/test/ui/borrowck/borrowck-mut-uniq.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] use std::mem::swap; @@ -20,7 +19,7 @@ fn iter_ints(x: &Ints, mut f: F) -> bool where F: FnMut(&isize) -> bool { } pub fn main() { - let mut ints: Box<_> = box Ints {sum: box 0, values: Vec::new()}; + let mut ints: Box<_> = Box::new(Ints {sum: Box::new(0), values: Vec::new()}); add_int(&mut *ints, 22); add_int(&mut *ints, 44); diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs index 4c1ff98ce6ec2..f035049d82d8d 100644 --- a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs +++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - struct Node_ { a: Box } @@ -8,8 +6,10 @@ enum Cycle { Node(Node_), Empty, } + fn main() { - let mut x: Box<_> = box Cycle::Node(Node_ {a: box Cycle::Empty}); + let mut x: Box<_> = Box::new(Cycle::Node(Node_ {a: Box::new(Cycle::Empty)})); + // Create a cycle! match *x { Cycle::Node(ref mut y) => { diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs index ddf6354c97341..344d75cc58f02 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - use std::ops::Index; struct MyVec { @@ -14,8 +12,10 @@ impl Index for MyVec { } } + + fn main() { - let v = MyVec::> { data: vec![box 1, box 2, box 3] }; + let v = MyVec::> { data: vec![Box::new(1), Box::new(2), Box::new(3)] }; let good = &v[0]; // Shouldn't fail here let bad = v[0]; //~^ ERROR cannot move out of index of `MyVec>` diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.rs b/src/test/ui/borrowck/borrowck-uniq-via-lend.rs index f62880788edb7..25d3e0b548646 100644 --- a/src/test/ui/borrowck/borrowck-uniq-via-lend.rs +++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.rs @@ -1,17 +1,17 @@ -#![feature(box_syntax)] +fn borrow(_v: &isize) {} + -fn borrow(_v: &isize) {} fn local() { - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); borrow(&*v); } fn local_rec() { struct F { f: Box } - let mut v = F {f: box 3}; + let mut v = F {f: Box::new(3)}; borrow(&*v.f); } @@ -19,35 +19,35 @@ fn local_recs() { struct F { f: G } struct G { g: H } struct H { h: Box } - let mut v = F {f: G {g: H {h: box 3}}}; + let mut v = F {f: G {g: H {h: Box::new(3)}}}; borrow(&*v.f.g.h); } fn aliased_imm() { - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); let w = &v; borrow(&*v); w.use_ref(); } fn aliased_mut() { - let mut v: Box<_> = box 3; + let mut v: Box<_> = Box::new(3); let w = &mut v; borrow(&*v); //~ ERROR cannot borrow `*v` w.use_mut(); } fn aliased_other() { - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let x = &mut w; borrow(&*v); x.use_mut(); } fn aliased_other_reassign() { - let mut v: Box<_> = box 3; - let mut w: Box<_> = box 4; + let mut v: Box<_> = Box::new(3); + let mut w: Box<_> = Box::new(4); let mut x = &mut w; x = &mut v; borrow(&*v); //~ ERROR cannot borrow `*v` diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow-rpass.rs b/src/test/ui/borrowck/borrowck-use-mut-borrow-rpass.rs index bcd1d3ccd8acb..1cf763f66fd20 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow-rpass.rs +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow-rpass.rs @@ -1,41 +1,39 @@ // 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 mut x = A { a: 1, b: Box::new(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 mut x = A { a: 1, b: Box::new(2) }; let p = &mut x.b; - let y = A { b: box 3, .. x }; + let y = A { b: Box::new(3), .. x }; drop(y); **p = 4; } fn field_deref_after_field_borrow() { - let mut x = A { a: 1, b: box 2 }; + let mut x = A { a: 1, b: Box::new(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 mut x = A { a: 1, b: Box::new(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 mut x = A { a: 1, b: Box::new(2) }; let p = &mut x.a; let y = A { a: 3, .. x }; drop(y); diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.rs b/src/test/ui/borrowck/borrowck-use-mut-borrow.rs index 95b165d6ef22f..94f88395ff9e2 100644 --- a/src/test/ui/borrowck/borrowck-use-mut-borrow.rs +++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax)] - #[derive(Copy, Clone)] struct A { a: isize, b: isize } struct B { a: isize, b: Box } + + fn var_copy_after_var_borrow() { let mut x: isize = 1; let p = &mut x; @@ -50,21 +50,21 @@ fn fu_field_copy_after_field_borrow() { } fn var_deref_after_var_borrow() { - let mut x: Box = box 1; + let mut x: Box = Box::new(1); let p = &mut x; drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed **p = 2; } fn field_deref_after_var_borrow() { - let mut x = B { a: 1, b: box 2 }; + let mut x = B { a: 1, b: Box::new(2) }; let p = &mut x; drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed p.a = 3; } fn field_deref_after_field_borrow() { - let mut x = B { a: 1, b: box 2 }; + let mut x = B { a: 1, b: Box::new(2) }; let p = &mut x.b; drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed **p = 3; diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs index 67b6c12ba803a..8a9296c597828 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.rs @@ -1,12 +1,12 @@ #![feature(box_patterns)] -#![feature(box_syntax)] + fn a() { - let mut vec = [box 1, box 2, box 3]; + let mut vec = [Box::new(1), Box::new(2), Box::new(3)]; match vec { [box ref _a, _, _] => { //~^ NOTE borrow of `vec[_]` occurs here - vec[0] = box 4; //~ ERROR cannot assign + vec[0] = Box::new(4); //~ ERROR cannot assign //~^ NOTE assignment to borrowed `vec[_]` occurs here _a.use_ref(); //~^ NOTE borrow later used here @@ -15,12 +15,12 @@ fn a() { } fn b() { - let mut vec = vec![box 1, box 2, box 3]; + let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)]; let vec: &mut [Box] = &mut vec; match vec { &mut [ref _b @ ..] => { //~^ borrow of `vec[_]` occurs here - vec[0] = box 4; //~ ERROR cannot assign + vec[0] = Box::new(4); //~ ERROR cannot assign //~^ NOTE assignment to borrowed `vec[_]` occurs here _b.use_ref(); //~^ NOTE borrow later used here @@ -29,7 +29,7 @@ fn b() { } fn c() { - let mut vec = vec![box 1, box 2, box 3]; + let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)]; let vec: &mut [Box] = &mut vec; match vec { //~^ ERROR cannot move out @@ -50,7 +50,7 @@ fn c() { } fn d() { - let mut vec = vec![box 1, box 2, box 3]; + let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)]; let vec: &mut [Box] = &mut vec; match vec { //~^ ERROR cannot move out @@ -69,7 +69,7 @@ fn d() { } fn e() { - let mut vec = vec![box 1, box 2, box 3]; + let mut vec = vec![Box::new(1), Box::new(2), Box::new(3)]; let vec: &mut [Box] = &mut vec; match vec { //~^ ERROR cannot move out diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr index 36f8f5c9ad739..41c9b3be28164 100644 --- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr +++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr @@ -4,7 +4,7 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed LL | [box ref _a, _, _] => { | ------ borrow of `vec[_]` occurs here LL | -LL | vec[0] = box 4; +LL | vec[0] = Box::new(4); | ^^^^^^ assignment to borrowed `vec[_]` occurs here LL | LL | _a.use_ref(); @@ -16,7 +16,7 @@ error[E0506]: cannot assign to `vec[_]` because it is borrowed LL | &mut [ref _b @ ..] => { | ----------- borrow of `vec[_]` occurs here LL | -LL | vec[0] = box 4; +LL | vec[0] = Box::new(4); | ^^^^^^ assignment to borrowed `vec[_]` occurs here LL | LL | _b.use_ref(); diff --git a/src/test/ui/borrowck/fsu-moves-and-copies.rs b/src/test/ui/borrowck/fsu-moves-and-copies.rs index 6a0b4ed17b962..85e0a840a1961 100644 --- a/src/test/ui/borrowck/fsu-moves-and-copies.rs +++ b/src/test/ui/borrowck/fsu-moves-and-copies.rs @@ -5,7 +5,7 @@ // Issue 4691: Ensure that functional-struct-updates operates // correctly and moves rather than copy when appropriate. -#![feature(box_syntax, core)] +#![feature(core)] struct ncint { v: isize } fn ncint(v: isize) -> ncint { ncint { v: v } } @@ -17,7 +17,7 @@ impl NoFoo { struct MoveFoo { copied: isize, moved: Box, } impl MoveFoo { - fn new(x:isize,y:isize) -> MoveFoo { MoveFoo { copied: x, moved: box y } } + fn new(x:isize,y:isize) -> MoveFoo { MoveFoo { copied: x, moved: Box::new(y) } } } struct DropNoFoo { inner: NoFoo } @@ -53,8 +53,8 @@ fn test0() { // Case 2: Owned let f = DropMoveFoo::new(5, 6); - let b = DropMoveFoo { inner: MoveFoo { moved: box 7, ..f.inner }}; - let c = DropMoveFoo { inner: MoveFoo { moved: box 8, ..f.inner }}; + let b = DropMoveFoo { inner: MoveFoo { moved: Box::new(7), ..f.inner }}; + let c = DropMoveFoo { inner: MoveFoo { moved: Box::new(8), ..f.inner }}; assert_eq!(f.inner.copied, 5); assert_eq!(*f.inner.moved, 6); @@ -69,7 +69,7 @@ fn test1() { // copying move-by-default fields from `f`, so it moves: let f = MoveFoo::new(11, 12); - let b = MoveFoo {moved: box 13, ..f}; + let b = MoveFoo {moved: Box::new(13), ..f}; let c = MoveFoo {copied: 14, ..f}; assert_eq!(b.copied, 11); assert_eq!(*b.moved, 13); diff --git a/src/test/ui/borrowck/issue-17263.rs b/src/test/ui/borrowck/issue-17263.rs index 7e9ff68548225..4f560b065f1b5 100644 --- a/src/test/ui/borrowck/issue-17263.rs +++ b/src/test/ui/borrowck/issue-17263.rs @@ -1,14 +1,12 @@ // check-pass -#![feature(box_syntax)] - struct Foo { a: isize, b: isize } fn main() { - let mut x: Box<_> = box Foo { a: 1, b: 2 }; + let mut x: Box<_> = Box::new(Foo { a: 1, b: 2 }); let (a, b) = (&mut x.a, &mut x.b); - let mut foo: Box<_> = box Foo { a: 1, b: 2 }; + let mut foo: Box<_> = Box::new(Foo { a: 1, b: 2 }); let (c, d) = (&mut foo.a, &foo.b); // We explicitly use the references created above to illustrate that the diff --git a/src/test/ui/cancel-clean-via-immediate-rvalue-ref.rs b/src/test/ui/cancel-clean-via-immediate-rvalue-ref.rs index 781d5c14abe9c..a0a561ab2d21e 100644 --- a/src/test/ui/cancel-clean-via-immediate-rvalue-ref.rs +++ b/src/test/ui/cancel-clean-via-immediate-rvalue-ref.rs @@ -1,12 +1,10 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - fn foo(x: &mut Box) { - *x = box 5; + *x = Box::new(5); } pub fn main() { - foo(&mut box 4); + foo(&mut Box::new(4)); } diff --git a/src/test/ui/class-cast-to-trait.rs b/src/test/ui/class-cast-to-trait.rs index bb4c3fac93806..345d6efd2d90a 100644 --- a/src/test/ui/class-cast-to-trait.rs +++ b/src/test/ui/class-cast-to-trait.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - trait Noisy { fn speak(&self); } @@ -48,7 +46,9 @@ fn cat(in_x : usize, in_y : isize, in_name: String) -> Cat { } } + + fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = Box::new(cat(0, 2, "nyan".to_string())) as Box; nyan.eat(); //~ ERROR no method named `eat` found } diff --git a/src/test/ui/cleanup-arm-conditional.rs b/src/test/ui/cleanup-arm-conditional.rs index 915842f3e85f2..38c717089c46b 100644 --- a/src/test/ui/cleanup-arm-conditional.rs +++ b/src/test/ui/cleanup-arm-conditional.rs @@ -7,7 +7,7 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax, os)] +#![feature(os)] use std::os; @@ -15,7 +15,7 @@ struct Test { x: isize } impl Test { fn get_x(&self) -> Option> { - Some(box self.x) + Some(Box::new(self.x)) } } diff --git a/src/test/ui/cleanup-rvalue-scopes.rs b/src/test/ui/cleanup-rvalue-scopes.rs index c5dd87c0f5a1f..b80f95b79f91d 100644 --- a/src/test/ui/cleanup-rvalue-scopes.rs +++ b/src/test/ui/cleanup-rvalue-scopes.rs @@ -7,7 +7,6 @@ // lifetime rules. #![feature(box_patterns)] -#![feature(box_syntax)] use std::ops::Drop; @@ -106,8 +105,8 @@ pub fn main() { end_of_block!(AddFlags { bits: ref _x }, AddFlags(1)); end_of_block!(&AddFlags { bits }, &AddFlags(1)); end_of_block!((_, ref _y), (AddFlags(1), 22)); - end_of_block!(box ref _x, box AddFlags(1)); - end_of_block!(box _x, box AddFlags(1)); + end_of_block!(box ref _x, std::boxed::Box::new(AddFlags(1))); + end_of_block!(box _x, std::boxed::Box::new(AddFlags(1))); end_of_block!(_, { { check_flags(0); &AddFlags(1) } }); end_of_block!(_, &((Box { f: AddFlags(1) }).f)); end_of_block!(_, &(([AddFlags(1)])[0])); diff --git a/src/test/ui/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/ui/cleanup-rvalue-temp-during-incomplete-alloc.rs index 62f8b81385aa3..eadbe44a8e9de 100644 --- a/src/test/ui/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/ui/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -21,8 +21,6 @@ // ignore-emscripten no threads support -#![feature(box_syntax)] - use std::thread; enum Conzabble { @@ -40,7 +38,7 @@ fn get_bar(x: usize) -> Vec { vec![x * 2] } pub fn fails() { let x = 2; let mut y: Vec> = Vec::new(); - y.push(box Conzabble::Bickwick(do_it(&get_bar(x)))); + y.push(Box::new(Conzabble::Bickwick(do_it(&get_bar(x))))); } pub fn main() { diff --git a/src/test/ui/clone-with-exterior.rs b/src/test/ui/clone-with-exterior.rs index 1ef2971926796..9fc661b14777e 100644 --- a/src/test/ui/clone-with-exterior.rs +++ b/src/test/ui/clone-with-exterior.rs @@ -3,8 +3,6 @@ #![allow(unused_must_use)] // ignore-emscripten no threads support -#![feature(box_syntax)] - use std::thread; struct Pair { @@ -13,7 +11,7 @@ struct Pair { } pub fn main() { - let z: Box<_> = box Pair { a : 10, b : 12}; + let z: Box<_> = Box::new(Pair { a : 10, b : 12}); thread::spawn(move|| { assert_eq!(z.a, 10); diff --git a/src/test/ui/close-over-big-then-small-data.rs b/src/test/ui/close-over-big-then-small-data.rs index 4d6edf4ecb0f3..429b21e8b8b99 100644 --- a/src/test/ui/close-over-big-then-small-data.rs +++ b/src/test/ui/close-over-big-then-small-data.rs @@ -5,8 +5,6 @@ // storing closure data (as we used to do), the u64 would // overwrite the u16. -#![feature(box_syntax)] - struct Pair { a: A, b: B } @@ -27,10 +25,10 @@ impl Invokable for Invoker { } fn f(a: A, b: u16) -> Box+'static> { - box Invoker { + Box::new(Invoker { a: a, b: b, - } as Box+'static> + }) as Box+'static> } pub fn main() { diff --git a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs index 6a8c9664051df..5ff7b1242db70 100644 --- a/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs +++ b/src/test/ui/closures/2229_closure_analysis/diagnostics/borrowck/borrowck-closures-mut-and-imm.rs @@ -1,10 +1,10 @@ // edition:2021 + + // Tests that two closures cannot simultaneously have mutable // and immutable access to the variable. Issue #6801. -#![feature(box_syntax)] - #[derive(Debug)] struct Point { x: i32, diff --git a/src/test/ui/coercion/coerce-expect-unsized.rs b/src/test/ui/coercion/coerce-expect-unsized.rs index d486fdf73aba8..eeb8fe82346c2 100644 --- a/src/test/ui/coercion/coerce-expect-unsized.rs +++ b/src/test/ui/coercion/coerce-expect-unsized.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_braces)] -#![feature(box_syntax)] use std::cell::RefCell; use std::fmt::Debug; diff --git a/src/test/ui/crate-method-reexport-grrrrrrr.rs b/src/test/ui/crate-method-reexport-grrrrrrr.rs index eefcf7738ada7..55e05cfb203b9 100644 --- a/src/test/ui/crate-method-reexport-grrrrrrr.rs +++ b/src/test/ui/crate-method-reexport-grrrrrrr.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - // This is a regression test that the metadata for the // name_pool::methods impl in the other crate is reachable from this // crate. @@ -14,7 +12,7 @@ extern crate crate_method_reexport_grrrrrrr2; pub fn main() { use crate_method_reexport_grrrrrrr2::rust::add; use crate_method_reexport_grrrrrrr2::rust::cx; - let x: Box<_> = box (); + let x: Box<_> = Box::new(()); x.cx(); let y = (); y.add("hi".to_string()); diff --git a/src/test/ui/cross-crate/auxiliary/cci_nested_lib.rs b/src/test/ui/cross-crate/auxiliary/cci_nested_lib.rs index 379ed076611f4..23d76ef3656e1 100644 --- a/src/test/ui/cross-crate/auxiliary/cci_nested_lib.rs +++ b/src/test/ui/cross-crate/auxiliary/cci_nested_lib.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - use std::cell::RefCell; pub struct Entry { @@ -37,7 +35,7 @@ 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()), + data: Box::new(RefCell::new(Vec::new())), }; } @@ -47,6 +45,6 @@ pub fn new_int_alist_2() -> alist { fn eq_int(a: isize, b: isize) -> bool { a == b } return alist { eq_fn: eq_int, - data: box RefCell::new(Vec::new()), + data: Box::new(RefCell::new(Vec::new())), }; } diff --git a/src/test/ui/cross-crate/cci_borrow.rs b/src/test/ui/cross-crate/cci_borrow.rs index 605a166ffa356..fee6b5d03a9e5 100644 --- a/src/test/ui/cross-crate/cci_borrow.rs +++ b/src/test/ui/cross-crate/cci_borrow.rs @@ -1,13 +1,11 @@ // 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 p: Box<_> = Box::new(22); let r = foo(&*p); println!("r={}", r); assert_eq!(r, 22); diff --git a/src/test/ui/deref.rs b/src/test/ui/deref.rs index cad4ede06a561..0d4e08ad95476 100644 --- a/src/test/ui/deref.rs +++ b/src/test/ui/deref.rs @@ -1,9 +1,7 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { - let x: Box = box 10; + let x: Box = Box::new(10); let _y: isize = *x; } diff --git a/src/test/ui/deriving/deriving-default-box.rs b/src/test/ui/deriving/deriving-default-box.rs index 237dbfaa05674..b71e114961388 100644 --- a/src/test/ui/deriving/deriving-default-box.rs +++ b/src/test/ui/deriving/deriving-default-box.rs @@ -1,6 +1,4 @@ // run-pass -#![feature(box_syntax)] - use std::default::Default; #[derive(Default)] diff --git a/src/test/ui/destructure-trait-ref.rs b/src/test/ui/destructure-trait-ref.rs index fdc9bbab73067..50b64aeebf0ef 100644 --- a/src/test/ui/destructure-trait-ref.rs +++ b/src/test/ui/destructure-trait-ref.rs @@ -2,11 +2,11 @@ // reference work properly. #![feature(box_patterns)] -#![feature(box_syntax)] trait T { fn foo(&self) {} } impl T for isize {} + fn main() { // For an expression of the form: // @@ -25,7 +25,7 @@ fn main() { // n == m let &x = &1isize as &dyn T; //~ ERROR type `&dyn T` cannot be dereferenced let &&x = &(&1isize as &dyn T); //~ ERROR type `&dyn T` cannot be dereferenced - let box x = box 1isize as Box; + let box x = Box::new(1isize) as Box; //~^ ERROR type `Box` cannot be dereferenced // n > m @@ -37,7 +37,7 @@ fn main() { //~^ ERROR mismatched types //~| expected trait object `dyn T` //~| found reference `&_` - let box box x = box 1isize as Box; + let box box x = Box::new(1isize) as Box; //~^ ERROR mismatched types //~| expected trait object `dyn T` //~| found struct `Box<_>` diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index fb43ca760b8c0..302917ca02e00 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -13,7 +13,7 @@ LL | let &&x = &(&1isize as &dyn T); error[E0033]: type `Box` cannot be dereferenced --> $DIR/destructure-trait-ref.rs:28:9 | -LL | let box x = box 1isize as Box; +LL | let box x = Box::new(1isize) as Box; | ^^^^^ type `Box` cannot be dereferenced error[E0308]: mismatched types @@ -43,8 +43,8 @@ LL | let &&&x = &(&1isize as &dyn T); error[E0308]: mismatched types --> $DIR/destructure-trait-ref.rs:40:13 | -LL | let box box x = box 1isize as Box; - | ^^^^^ ------------------------ this expression has type `Box` +LL | let box box x = Box::new(1isize) as Box; + | ^^^^^ ------------------------------ this expression has type `Box` | | | expected trait object `dyn T`, found struct `Box` | diff --git a/src/test/ui/drop/drop-on-empty-block-exit.rs b/src/test/ui/drop/drop-on-empty-block-exit.rs index 1747bf029aa33..ef3a90a53a6a0 100644 --- a/src/test/ui/drop/drop-on-empty-block-exit.rs +++ b/src/test/ui/drop/drop-on-empty-block-exit.rs @@ -2,11 +2,9 @@ // 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); + let tt = t::foo(Box::new(10)); match tt { t::foo(_z) => { } } } diff --git a/src/test/ui/drop/drop-struct-as-object.rs b/src/test/ui/drop/drop-struct-as-object.rs index 1bc3b4c157ca8..377027a4fc5f2 100644 --- a/src/test/ui/drop/drop-struct-as-object.rs +++ b/src/test/ui/drop/drop-struct-as-object.rs @@ -5,8 +5,6 @@ // 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 { @@ -29,7 +27,7 @@ impl Drop for Cat { pub fn main() { { - let x = box Cat {name: 22}; + let x = Box::new(Cat {name: 22}); let nyan: Box = x as Box; } unsafe { diff --git a/src/test/ui/drop/drop-trait-enum.rs b/src/test/ui/drop/drop-trait-enum.rs index aec46575f97fc..4ab8f733ad75a 100644 --- a/src/test/ui/drop/drop-trait-enum.rs +++ b/src/test/ui/drop/drop-trait-enum.rs @@ -4,8 +4,6 @@ #![allow(unused_variables)] // ignore-emscripten no threads support -#![feature(box_syntax)] - use std::thread; use std::sync::mpsc::{channel, Sender}; @@ -57,7 +55,7 @@ pub fn main() { let (sender, receiver) = channel(); { - let v = Foo::NestedVariant(box 42, SendOnDrop { sender: sender.clone() }, sender); + let v = Foo::NestedVariant(Box::new(42), SendOnDrop { sender: sender.clone() }, sender); } assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); assert_eq!(receiver.recv().unwrap(), Message::Dropped); @@ -74,10 +72,10 @@ pub fn main() { let (sender, receiver) = channel(); let t = { thread::spawn(move|| { - let mut v = Foo::NestedVariant(box 42, SendOnDrop { + let mut v = Foo::NestedVariant(Box::new(42), SendOnDrop { sender: sender.clone() }, sender.clone()); - v = Foo::NestedVariant(box 42, + v = Foo::NestedVariant(Box::new(42), SendOnDrop { sender: sender.clone() }, sender.clone()); v = Foo::SimpleVariant(sender.clone()); diff --git a/src/test/ui/dynamically-sized-types/dst-trait-tuple.rs b/src/test/ui/dynamically-sized-types/dst-trait-tuple.rs index 70bcc3de07d29..c1e45215ad8c4 100644 --- a/src/test/ui/dynamically-sized-types/dst-trait-tuple.rs +++ b/src/test/ui/dynamically-sized-types/dst-trait-tuple.rs @@ -2,7 +2,6 @@ #![allow(type_alias_bounds)] #![allow(unused_features)] -#![feature(box_syntax)] #![feature(unsized_tuple_coercion)] type Fat = (isize, &'static str, T); diff --git a/src/test/ui/dynamically-sized-types/dst-tuple.rs b/src/test/ui/dynamically-sized-types/dst-tuple.rs index f70a45a1b3574..604ac51129010 100644 --- a/src/test/ui/dynamically-sized-types/dst-tuple.rs +++ b/src/test/ui/dynamically-sized-types/dst-tuple.rs @@ -1,7 +1,6 @@ // run-pass #![allow(type_alias_bounds)] -#![feature(box_syntax)] #![feature(unsized_tuple_coercion)] type Fat = (isize, &'static str, T); @@ -109,7 +108,7 @@ pub fn main() { assert_eq!((*f2)[1], 2); // Nested Box. - let f1 : Box> = box (5, "some str", [1, 2, 3]); + let f1 : Box> = Box::new((5, "some str", [1, 2, 3])); foo(&*f1); let f2 : Box> = f1; foo(&*f2); diff --git a/src/test/ui/expr-block-generic-unique1.rs b/src/test/ui/expr-block-generic-unique1.rs index d081cb2be7ee3..14603a2c71fc4 100644 --- a/src/test/ui/expr-block-generic-unique1.rs +++ b/src/test/ui/expr-block-generic-unique1.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_braces)] -#![feature(box_syntax)] fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { let actual: Box = { expected.clone() }; @@ -13,7 +12,7 @@ fn test_box() { println!("{}", *b2); return *b1 == *b2; } - test_generic::(box true, compare_box); + test_generic::(Box::new(true), compare_box); } pub fn main() { test_box(); } diff --git a/src/test/ui/expr-block-generic-unique2.rs b/src/test/ui/expr-block-generic-unique2.rs index 9362eb86fc309..7879c144b1092 100644 --- a/src/test/ui/expr-block-generic-unique2.rs +++ b/src/test/ui/expr-block-generic-unique2.rs @@ -1,6 +1,5 @@ // run-pass #![allow(unused_braces)] -#![feature(box_syntax)] fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { let actual: T = { expected.clone() }; @@ -9,7 +8,7 @@ fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> boo fn test_vec() { fn compare_vec(v1: Box, v2: Box) -> bool { return v1 == v2; } - test_generic::, _>(box 1, compare_vec); + test_generic::, _>(Box::new(1), compare_vec); } pub fn main() { test_vec(); } diff --git a/src/test/ui/expr-block-unique.rs b/src/test/ui/expr-block-unique.rs index eff3fd3a15152..5fa11ad1283b9 100644 --- a/src/test/ui/expr-block-unique.rs +++ b/src/test/ui/expr-block-unique.rs @@ -1,5 +1,4 @@ // run-pass #![allow(unused_braces)] -#![feature(box_syntax)] -pub fn main() { let x: Box<_> = { box 100 }; assert_eq!(*x, 100); } +pub fn main() { let x: Box<_> = { Box::new(100) }; assert_eq!(*x, 100); } diff --git a/src/test/ui/expr-if-unique.rs b/src/test/ui/expr-if-unique.rs index 509d069d40fec..86232683549b6 100644 --- a/src/test/ui/expr-if-unique.rs +++ b/src/test/ui/expr-if-unique.rs @@ -1,10 +1,8 @@ // run-pass -#![feature(box_syntax)] - // Tests for if as expressions returning boxed types fn test_box() { - let rs: Box<_> = if true { box 100 } else { box 101 }; + let rs: Box<_> = if true { Box::new(100) } else { Box::new(101) }; assert_eq!(*rs, 100); } diff --git a/src/test/ui/fn/fn-trait-formatting.rs b/src/test/ui/fn/fn-trait-formatting.rs index 0c389e1dc57a9..636ac7107e62a 100644 --- a/src/test/ui/fn/fn-trait-formatting.rs +++ b/src/test/ui/fn/fn-trait-formatting.rs @@ -1,17 +1,17 @@ -#![feature(box_syntax)] - fn needs_fn(x: F) where F: Fn(isize) -> isize {} + + fn main() { - let _: () = (box |_: isize| {}) as Box; + let _: () = Box::new(|_: isize| {}) as Box; //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Box` - let _: () = (box |_: isize, isize| {}) as Box; + let _: () = Box::new(|_: isize, isize| {}) as Box; //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Box` - let _: () = (box || -> isize { unimplemented!() }) as Box isize>; + let _: () = Box::new(|| -> isize { unimplemented!() }) as Box isize>; //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Box isize>` diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr index f9fb3a0ef267d..ea88e401bed87 100644 --- a/src/test/ui/fn/fn-trait-formatting.stderr +++ b/src/test/ui/fn/fn-trait-formatting.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:6:17 | -LL | let _: () = (box |_: isize| {}) as Box; - | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` +LL | let _: () = Box::new(|_: isize| {}) as Box; + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` | | | expected due to this | @@ -12,8 +12,8 @@ LL | let _: () = (box |_: isize| {}) as Box; error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:10:17 | -LL | let _: () = (box |_: isize, isize| {}) as Box; - | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` +LL | let _: () = Box::new(|_: isize, isize| {}) as Box; + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` | | | expected due to this | @@ -23,8 +23,8 @@ LL | let _: () = (box |_: isize, isize| {}) as Box; error[E0308]: mismatched types --> $DIR/fn-trait-formatting.rs:14:17 | -LL | let _: () = (box || -> isize { unimplemented!() }) as Box isize>; - | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` +LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box isize>; + | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box` | | | expected due to this | @@ -41,7 +41,7 @@ LL | needs_fn(1); | = help: the trait `Fn<(isize,)>` is not implemented for `{integer}` note: required by a bound in `needs_fn` - --> $DIR/fn-trait-formatting.rs:3:31 + --> $DIR/fn-trait-formatting.rs:1:31 | LL | fn needs_fn(x: F) where F: Fn(isize) -> isize {} | ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn` diff --git a/src/test/ui/for-loop-while/cleanup-rvalue-during-if-and-while.rs b/src/test/ui/for-loop-while/cleanup-rvalue-during-if-and-while.rs index 6fecb4e76da32..afc77355ab00a 100644 --- a/src/test/ui/for-loop-while/cleanup-rvalue-during-if-and-while.rs +++ b/src/test/ui/for-loop-while/cleanup-rvalue-during-if-and-while.rs @@ -2,8 +2,6 @@ // This test verifies that temporaries created for `while`'s and `if` // conditions are dropped after the condition is evaluated. -#![feature(box_syntax)] - struct Temporary; static mut DROPPED: isize = 0; @@ -18,7 +16,7 @@ impl Temporary { fn do_stuff(&self) -> bool {true} } -fn borrow() -> Box { box Temporary } +fn borrow() -> Box { Box::new(Temporary) } pub fn main() { diff --git a/src/test/ui/generics/generic-alias-unique.rs b/src/test/ui/generics/generic-alias-unique.rs index 76a184d8d256a..fc138398634d5 100644 --- a/src/test/ui/generics/generic-alias-unique.rs +++ b/src/test/ui/generics/generic-alias-unique.rs @@ -1,10 +1,9 @@ // run-pass -#![feature(box_syntax)] fn id(t: T) -> T { return t; } pub fn main() { - let expected: Box<_> = box 100; + let expected: Box<_> = Box::new(100); let actual = id::>(expected.clone()); println!("{}", *actual); assert_eq!(*expected, *actual); diff --git a/src/test/ui/generics/generic-exterior-unique.rs b/src/test/ui/generics/generic-exterior-unique.rs index 9b3e1ee02a2af..10d87f9f43d0d 100644 --- a/src/test/ui/generics/generic-exterior-unique.rs +++ b/src/test/ui/generics/generic-exterior-unique.rs @@ -1,9 +1,8 @@ // run-pass -#![feature(box_syntax)] struct Recbox {x: Box} -fn reclift(t: T) -> Recbox { return Recbox {x: box t}; } +fn reclift(t: T) -> Recbox { return Recbox { x: Box::new(t) }; } pub fn main() { let foo: isize = 17; diff --git a/src/test/ui/generics/generic-fn-unique.rs b/src/test/ui/generics/generic-fn-unique.rs index 6cda1c3dc15e1..7e246bce9a10c 100644 --- a/src/test/ui/generics/generic-fn-unique.rs +++ b/src/test/ui/generics/generic-fn-unique.rs @@ -1,6 +1,8 @@ // run-pass -#![feature(box_syntax)] fn f(x: Box) -> Box { return x; } -pub fn main() { let x = f(box 3); println!("{}", *x); } +pub fn main() { + let x = f(Box::new(3)); + println!("{}", *x); +} diff --git a/src/test/ui/generics/generic-object.rs b/src/test/ui/generics/generic-object.rs index 870ff980ec64d..851424a11b5c1 100644 --- a/src/test/ui/generics/generic-object.rs +++ b/src/test/ui/generics/generic-object.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] trait Foo { fn get(&self) -> T; @@ -16,7 +15,7 @@ impl Foo for S { } pub fn main() { - let x = box S { x: 1 }; + let x = Box::new(S { x: 1 }); let y = x as Box>; assert_eq!(y.get(), 1); } diff --git a/src/test/ui/generics/generic-recursive-tag.rs b/src/test/ui/generics/generic-recursive-tag.rs index e1875f0abbe61..74f5b701d98a5 100644 --- a/src/test/ui/generics/generic-recursive-tag.rs +++ b/src/test/ui/generics/generic-recursive-tag.rs @@ -1,13 +1,12 @@ // 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::))); + list::cons::(Box::new(10), + Box::new(list::cons::(Box::new(12), + Box::new(list::cons::(Box::new(13), + Box::new(list::nil::)))))); } diff --git a/src/test/ui/generics/generic-tag.rs b/src/test/ui/generics/generic-tag.rs index 74ef4eeba8ab7..67f2ccdde34a1 100644 --- a/src/test/ui/generics/generic-tag.rs +++ b/src/test/ui/generics/generic-tag.rs @@ -5,11 +5,10 @@ // 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); + let mut a: option = option::some::(Box::new(10)); a = option::none::; } diff --git a/src/test/ui/generics/generic-unique.rs b/src/test/ui/generics/generic-unique.rs index d36504c75dd9c..2f34712ecfbf3 100644 --- a/src/test/ui/generics/generic-unique.rs +++ b/src/test/ui/generics/generic-unique.rs @@ -1,10 +1,9 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] struct Triple { x: T, y: T, z: T } -fn box_it(x: Triple) -> Box> { return box x; } +fn box_it(x: Triple) -> Box> { return Box::new(x); } pub fn main() { let x: Box> = box_it::(Triple{x: 1, y: 2, z: 3}); diff --git a/src/test/ui/infinite/infinite-autoderef.rs b/src/test/ui/infinite/infinite-autoderef.rs index 6d6908ef7f63e..ca26252832bcd 100644 --- a/src/test/ui/infinite/infinite-autoderef.rs +++ b/src/test/ui/infinite/infinite-autoderef.rs @@ -1,6 +1,6 @@ // error-pattern: reached the recursion limit while auto-dereferencing -#![feature(box_syntax)] + use std::ops::Deref; @@ -17,7 +17,7 @@ impl Deref for Foo { pub fn main() { let mut x; loop { - x = box x; + x = Box::new(x); x.foo; x.bar(); } diff --git a/src/test/ui/infinite/infinite-autoderef.stderr b/src/test/ui/infinite/infinite-autoderef.stderr index cbefbf83be0a2..1f26ba30000b4 100644 --- a/src/test/ui/infinite/infinite-autoderef.stderr +++ b/src/test/ui/infinite/infinite-autoderef.stderr @@ -1,13 +1,10 @@ error[E0308]: mismatched types --> $DIR/infinite-autoderef.rs:20:13 | -LL | x = box x; - | ^^^^^ cyclic type of infinite size - | -help: try using a conversion method - | -LL | x = (box x).to_string(); - | + +++++++++++++ +LL | x = Box::new(x); + | ^^^^^^^^^^^- help: try using a conversion method: `.to_string()` + | | + | cyclic type of infinite size error[E0055]: reached the recursion limit while auto-dereferencing `Foo` --> $DIR/infinite-autoderef.rs:25:5 diff --git a/src/test/ui/init-res-into-things.rs b/src/test/ui/init-res-into-things.rs index ed0c600c1d2e7..7f416262dcb8c 100644 --- a/src/test/ui/init-res-into-things.rs +++ b/src/test/ui/init-res-into-things.rs @@ -2,7 +2,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -#![feature(box_syntax)] use std::cell::Cell; @@ -58,7 +57,7 @@ fn test_tup() { fn test_unique() { let i = &Cell::new(0); { - let _a: Box<_> = box r(i); + let _a: Box<_> = Box::new(r(i)); } assert_eq!(i.get(), 1); } @@ -66,9 +65,9 @@ fn test_unique() { fn test_unique_rec() { let i = &Cell::new(0); { - let _a: Box<_> = box BoxR { + let _a: Box<_> = Box::new(BoxR { x: r(i) - }; + }); } assert_eq!(i.get(), 1); } diff --git a/src/test/ui/intrinsics/intrinsic-atomics.rs b/src/test/ui/intrinsics/intrinsic-atomics.rs index 608cf3dee5230..c6e48e8b5afba 100644 --- a/src/test/ui/intrinsics/intrinsic-atomics.rs +++ b/src/test/ui/intrinsics/intrinsic-atomics.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] #![feature(intrinsics)] mod rusti { @@ -34,7 +33,7 @@ mod rusti { pub fn main() { unsafe { - let mut x: Box<_> = box 1; + let mut x: Box<_> = Box::new(1); assert_eq!(rusti::atomic_load(&*x), 1); *x = 5; diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.rs b/src/test/ui/kindck/kindck-impl-type-params-2.rs index c08f776dbf20a..8b0771985dc3f 100644 --- a/src/test/ui/kindck/kindck-impl-type-params-2.rs +++ b/src/test/ui/kindck/kindck-impl-type-params-2.rs @@ -1,15 +1,15 @@ -#![feature(box_syntax)] - trait Foo { } + + impl Foo for T { } fn take_param(foo: &T) { } fn main() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); take_param(&x); //~^ ERROR the trait bound `Box<{integer}>: Foo` is not satisfied } diff --git a/src/test/ui/kindck/kindck-impl-type-params.rs b/src/test/ui/kindck/kindck-impl-type-params.rs index 4d4d191b6aaee..5622d65cb175b 100644 --- a/src/test/ui/kindck/kindck-impl-type-params.rs +++ b/src/test/ui/kindck/kindck-impl-type-params.rs @@ -1,7 +1,7 @@ // Issue #14061: tests the interaction between generic implementation // parameter bounds and trait objects. -#![feature(box_syntax)] + use std::marker; @@ -34,7 +34,7 @@ fn foo<'a>() { } fn foo2<'a>() { - let t: Box> = box S(marker::PhantomData); + let t: Box> = Box::new(S(marker::PhantomData)); let a = t as Box>; //~^ ERROR : Copy` is not satisfied } @@ -42,7 +42,7 @@ fn foo2<'a>() { fn foo3<'a>() { struct Foo; // does not impl Copy - let t: Box> = box S(marker::PhantomData); + let t: Box> = Box::new(S(marker::PhantomData)); let a: Box> = t; //~^ ERROR : Copy` is not satisfied } diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.rs b/src/test/ui/kindck/kindck-inherited-copy-bound.rs index aad693e5b1937..87d47556bdd25 100644 --- a/src/test/ui/kindck/kindck-inherited-copy-bound.rs +++ b/src/test/ui/kindck/kindck-inherited-copy-bound.rs @@ -3,7 +3,7 @@ // revisions: curr object_safe_for_dispatch #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))] -#![feature(box_syntax)] + use std::any::Any; @@ -17,13 +17,13 @@ impl Foo for T { fn take_param(foo: &T) { } fn a() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); take_param(&x); //[curr]~ ERROR E0277 //[object_safe_for_dispatch]~^ ERROR E0277 } fn b() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); let y = &x; let z = &x as &dyn Foo; //[curr]~^ ERROR E0038 diff --git a/src/test/ui/last-use-is-capture.rs b/src/test/ui/last-use-is-capture.rs index af2308777939e..1055fe7995ba6 100644 --- a/src/test/ui/last-use-is-capture.rs +++ b/src/test/ui/last-use-is-capture.rs @@ -3,13 +3,11 @@ #![allow(dead_code)] // Make sure #1399 stays fixed -#![feature(box_syntax)] - struct A { a: Box } pub fn main() { fn invoke(f: F) where F: FnOnce() { f(); } - let k: Box<_> = box 22; + let k: Box<_> = 22.into(); let _u = A {a: k.clone()}; invoke(|| println!("{}", k.clone()) ) } diff --git a/src/test/ui/leak-unique-as-tydesc.rs b/src/test/ui/leak-unique-as-tydesc.rs index 752081b78f275..322f726156d0c 100644 --- a/src/test/ui/leak-unique-as-tydesc.rs +++ b/src/test/ui/leak-unique-as-tydesc.rs @@ -1,8 +1,9 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - fn leaky(_t: T) { } -pub fn main() { let x = box 10; leaky::>(x); } +pub fn main() { + let x = Box::new(10); + leaky::>(x); +} diff --git a/src/test/ui/lint/lint-owned-heap-memory.rs b/src/test/ui/lint/lint-owned-heap-memory.rs index 7ef18c28c1ab7..af47d5c072005 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.rs +++ b/src/test/ui/lint/lint-owned-heap-memory.rs @@ -1,12 +1,12 @@ #![allow(dead_code)] #![forbid(box_pointers)] -#![feature(box_syntax)] + struct Foo { x: Box //~ ERROR type uses owned } fn main() { - let _x : Foo = Foo {x : box 10}; + let _x: Foo = Foo { x : Box::new(10) }; //~^ ERROR type uses owned } diff --git a/src/test/ui/lint/lint-owned-heap-memory.stderr b/src/test/ui/lint/lint-owned-heap-memory.stderr index 40310f9387455..5ba3969707571 100644 --- a/src/test/ui/lint/lint-owned-heap-memory.stderr +++ b/src/test/ui/lint/lint-owned-heap-memory.stderr @@ -13,8 +13,8 @@ LL | #![forbid(box_pointers)] error: type uses owned (Box type) pointers: Box --> $DIR/lint-owned-heap-memory.rs:10:29 | -LL | let _x : Foo = Foo {x : box 10}; - | ^^^^^^ +LL | let _x: Foo = Foo { x : Box::new(10) }; + | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.rs b/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.rs index 0ad014e3361b7..4822a9b2c7ff8 100644 --- a/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.rs +++ b/src/test/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.rs @@ -1,7 +1,7 @@ // check-pass -#![feature(box_syntax)] #![feature(box_patterns)] + #![warn(unused)] // UI tests pass `-A unused` (#43896) struct SoulHistory { @@ -67,7 +67,7 @@ fn main() { }; // Boxed struct - match box bag { + match Box::new(bag) { box Large::Suit { case } => {} //~ WARNING unused variable: `case` }; diff --git a/src/test/ui/list.rs b/src/test/ui/list.rs index 2ac5733b4199b..cb83d4103dced 100644 --- a/src/test/ui/list.rs +++ b/src/test/ui/list.rs @@ -3,8 +3,8 @@ #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - enum list { cons(isize, Box), nil, } -pub fn main() { list::cons(10, box list::cons(11, box list::cons(12, box list::nil))); } +pub fn main() { + list::cons(10, Box::new(list::cons(11, Box::new(list::cons(12, Box::new(list::nil)))))); +} diff --git a/src/test/ui/liveness/liveness-move-call-arg.rs b/src/test/ui/liveness/liveness-move-call-arg.rs index 98d12f5747aae..1bc2ea6b9fef6 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.rs +++ b/src/test/ui/liveness/liveness-move-call-arg.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax)] - fn take(_x: Box) {} + fn main() { - let x: Box = box 25; + let x: Box = Box::new(25); + loop { take(x); //~ ERROR use of moved value: `x` } diff --git a/src/test/ui/liveness/liveness-move-call-arg.stderr b/src/test/ui/liveness/liveness-move-call-arg.stderr index 5ea5c40f2ac97..7c0e916eddcaa 100644 --- a/src/test/ui/liveness/liveness-move-call-arg.stderr +++ b/src/test/ui/liveness/liveness-move-call-arg.stderr @@ -1,9 +1,9 @@ error[E0382]: use of moved value: `x` --> $DIR/liveness-move-call-arg.rs:9:14 | -LL | let x: Box = box 25; +LL | let x: Box = Box::new(25); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait -LL | loop { +... LL | take(x); | ^ value moved here, in previous iteration of loop diff --git a/src/test/ui/liveness/liveness-move-in-loop.rs b/src/test/ui/liveness/liveness-move-in-loop.rs index eb3288a28e2bc..064be14d6d28c 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.rs +++ b/src/test/ui/liveness/liveness-move-in-loop.rs @@ -1,8 +1,8 @@ -#![feature(box_syntax)] - fn main() { - let y: Box = box 42; + + let y: Box = 42.into(); let mut x: Box; + loop { println!("{}", y); loop { diff --git a/src/test/ui/liveness/liveness-move-in-loop.stderr b/src/test/ui/liveness/liveness-move-in-loop.stderr index 66b6373e45055..832d4f8fa030f 100644 --- a/src/test/ui/liveness/liveness-move-in-loop.stderr +++ b/src/test/ui/liveness/liveness-move-in-loop.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `y` --> $DIR/liveness-move-in-loop.rs:11:25 | -LL | let y: Box = box 42; +LL | let y: Box = 42.into(); | - move occurs because `y` has type `Box`, which does not implement the `Copy` trait ... LL | x = y; diff --git a/src/test/ui/liveness/liveness-move-in-while.rs b/src/test/ui/liveness/liveness-move-in-while.rs index 9f3ebf1362b82..7c0cd282c97e0 100644 --- a/src/test/ui/liveness/liveness-move-in-while.rs +++ b/src/test/ui/liveness/liveness-move-in-while.rs @@ -1,8 +1,8 @@ -#![feature(box_syntax)] - fn main() { - let y: Box = box 42; + + let y: Box = 42.into(); let mut x: Box; + loop { println!("{}", y); //~ ERROR borrow of moved value: `y` while true { while true { while true { x = y; x.clone(); } } } diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr index 92e0f37252158..6a8f239bd09a8 100644 --- a/src/test/ui/liveness/liveness-move-in-while.stderr +++ b/src/test/ui/liveness/liveness-move-in-while.stderr @@ -21,7 +21,7 @@ LL | while true { while true { while true { x = y; x.clone(); } } } error[E0382]: borrow of moved value: `y` --> $DIR/liveness-move-in-while.rs:7:24 | -LL | let y: Box = box 42; +LL | let y: Box = 42.into(); | - move occurs because `y` has type `Box`, which does not implement the `Copy` trait ... LL | println!("{}", y); diff --git a/src/test/ui/liveness/liveness-use-after-move.rs b/src/test/ui/liveness/liveness-use-after-move.rs index 5263e293603cd..46102ca1eb11e 100644 --- a/src/test/ui/liveness/liveness-use-after-move.rs +++ b/src/test/ui/liveness/liveness-use-after-move.rs @@ -1,8 +1,8 @@ -#![feature(box_syntax)] - fn main() { - let x: Box<_> = box 5; + + let x: Box<_> = 5.into(); let y = x; + println!("{}", *x); //~ ERROR borrow of moved value: `x` y.clone(); } diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr index 3977a3f4136d2..292ce013dcc76 100644 --- a/src/test/ui/liveness/liveness-use-after-move.stderr +++ b/src/test/ui/liveness/liveness-use-after-move.stderr @@ -1,10 +1,11 @@ error[E0382]: borrow of moved value: `x` --> $DIR/liveness-use-after-move.rs:6:20 | -LL | let x: Box<_> = box 5; +LL | let x: Box<_> = 5.into(); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait LL | let y = x; | - value moved here +LL | LL | println!("{}", *x); | ^^ value borrowed here after move diff --git a/src/test/ui/map-types.rs b/src/test/ui/map-types.rs index 89b57087507c8..dc33b961800ea 100644 --- a/src/test/ui/map-types.rs +++ b/src/test/ui/map-types.rs @@ -1,7 +1,7 @@ -#![feature(box_syntax)] - use std::collections::HashMap; + + trait Map { fn get(&self, k: K) -> V { panic!() } @@ -12,7 +12,7 @@ impl Map for HashMap {} // Test that trait types printed in error msgs include the type arguments. fn main() { - let x: Box> = box HashMap::new(); + let x: Box> = HashMap::new().into(); let x: Box> = x; let y: Box> = Box::new(x); //~^ ERROR `Box>: Map` is not satisfied diff --git a/src/test/ui/methods/auxiliary/method_self_arg1.rs b/src/test/ui/methods/auxiliary/method_self_arg1.rs index 8258fdd9ab93a..f89019fe5859f 100644 --- a/src/test/ui/methods/auxiliary/method_self_arg1.rs +++ b/src/test/ui/methods/auxiliary/method_self_arg1.rs @@ -1,7 +1,5 @@ #![crate_type = "lib"] -#![feature(box_syntax)] - static mut COUNT: u64 = 1; pub fn get_count() -> u64 { unsafe { COUNT } } @@ -19,8 +17,8 @@ impl Foo { Foo::baz(self); Foo::baz(*x); - Foo::qux(box self); - Foo::qux(box *x); + Foo::qux(Box::new(self)); + Foo::qux(Box::new(*x)); } pub fn bar(&self) { diff --git a/src/test/ui/methods/auxiliary/method_self_arg2.rs b/src/test/ui/methods/auxiliary/method_self_arg2.rs index 94a4a016c3eca..96725456291ea 100644 --- a/src/test/ui/methods/auxiliary/method_self_arg2.rs +++ b/src/test/ui/methods/auxiliary/method_self_arg2.rs @@ -1,7 +1,5 @@ #![crate_type = "lib"] -#![feature(box_syntax)] - static mut COUNT: u64 = 1; pub fn get_count() -> u64 { unsafe { COUNT } } @@ -15,11 +13,11 @@ impl Foo { // Test internal call. Bar::foo1(&self); Bar::foo2(self); - Bar::foo3(box self); + Bar::foo3(Box::new(self)); Bar::bar1(&self); Bar::bar2(self); - Bar::bar3(box self); + Bar::bar3(Box::new(self)); } } diff --git a/src/test/ui/methods/method-self-arg-aux1.rs b/src/test/ui/methods/method-self-arg-aux1.rs index 9e38ff7de3424..79b70a17ca187 100644 --- a/src/test/ui/methods/method-self-arg-aux1.rs +++ b/src/test/ui/methods/method-self-arg-aux1.rs @@ -1,8 +1,6 @@ // 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; @@ -12,7 +10,7 @@ fn main() { // Test external call. Foo::bar(&x); Foo::baz(x); - Foo::qux(box x); + Foo::qux(Box::new(x)); x.foo(&x); diff --git a/src/test/ui/methods/method-self-arg-aux2.rs b/src/test/ui/methods/method-self-arg-aux2.rs index 8e70399d047cd..16487b54f174f 100644 --- a/src/test/ui/methods/method-self-arg-aux2.rs +++ b/src/test/ui/methods/method-self-arg-aux2.rs @@ -1,8 +1,6 @@ // 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}; @@ -12,11 +10,11 @@ fn main() { // Test external call. Bar::foo1(&x); Bar::foo2(x); - Bar::foo3(box x); + Bar::foo3(Box::new(x)); Bar::bar1(&x); Bar::bar2(x); - Bar::bar3(box x); + Bar::bar3(Box::new(x)); x.run_trait(); diff --git a/src/test/ui/methods/method-self-arg-trait.rs b/src/test/ui/methods/method-self-arg-trait.rs index 227b1eab25de2..ffa7a552b25a3 100644 --- a/src/test/ui/methods/method-self-arg-trait.rs +++ b/src/test/ui/methods/method-self-arg-trait.rs @@ -1,8 +1,6 @@ // run-pass // Test method calls with self as an argument -#![feature(box_syntax)] - static mut COUNT: u64 = 1; #[derive(Copy, Clone)] @@ -44,11 +42,11 @@ impl Foo { // Test internal call. Bar::foo1(&self); Bar::foo2(self); - Bar::foo3(box self); + Bar::foo3(Box::new(self)); Bar::bar1(&self); Bar::bar2(self); - Bar::bar3(box self); + Bar::bar3(Box::new(self)); } } @@ -57,11 +55,11 @@ fn main() { // Test external call. Bar::foo1(&x); Bar::foo2(x); - Bar::foo3(box x); + Bar::foo3(Box::new(x)); Bar::bar1(&x); Bar::bar2(x); - Bar::bar3(box x); + Bar::bar3(Box::new(x)); x.baz(); diff --git a/src/test/ui/methods/method-self-arg.rs b/src/test/ui/methods/method-self-arg.rs index 2d25b0dbad196..f738fa19c852a 100644 --- a/src/test/ui/methods/method-self-arg.rs +++ b/src/test/ui/methods/method-self-arg.rs @@ -1,8 +1,6 @@ // run-pass // Test method calls with self as an argument -#![feature(box_syntax)] - static mut COUNT: usize = 1; #[derive(Copy, Clone)] @@ -18,8 +16,8 @@ impl Foo { Foo::baz(self); Foo::baz(*x); - Foo::qux(box self); - Foo::qux(box *x); + Foo::qux(Box::new(self)); + Foo::qux(Box::new(*x)); } fn bar(&self) { @@ -40,7 +38,7 @@ fn main() { // Test external call. Foo::bar(&x); Foo::baz(x); - Foo::qux(box x); + Foo::qux(Box::new(x)); x.foo(&x); diff --git a/src/test/ui/methods/method-two-trait-defer-resolution-2.rs b/src/test/ui/methods/method-two-trait-defer-resolution-2.rs index 8af3dcf5c3db0..fc5766da9714b 100644 --- a/src/test/ui/methods/method-two-trait-defer-resolution-2.rs +++ b/src/test/ui/methods/method-two-trait-defer-resolution-2.rs @@ -10,8 +10,6 @@ // codegen the call as `Foo::foo(&x)` and let the specific impl get // chosen later. -#![feature(box_syntax)] - trait Foo { fn foo(&self) -> isize; } @@ -37,7 +35,7 @@ fn call_foo_copy() -> isize { fn call_foo_other() -> isize { let mut x: Vec<_> = Vec::new(); let y = x.foo(); - let z: Box = box 0; + let z: Box = Box::new(0); x.push(z); y } diff --git a/src/test/ui/moves/move-1-unique.rs b/src/test/ui/moves/move-1-unique.rs index 7d3987f656087..f98d075d18bba 100644 --- a/src/test/ui/moves/move-1-unique.rs +++ b/src/test/ui/moves/move-1-unique.rs @@ -1,7 +1,6 @@ // run-pass #![allow(unused_mut)] #![allow(dead_code)] -#![feature(box_syntax)] #[derive(Clone)] struct Triple { @@ -13,12 +12,12 @@ struct Triple { 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}; } + if x { y = bar; } else { y = Box::new(Triple{x: 4, y: 5, z: 6}); } return y.y; } pub fn main() { - let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; + let x: Box<_> = Box::new(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); diff --git a/src/test/ui/moves/move-2-unique.rs b/src/test/ui/moves/move-2-unique.rs index 910a88c102f0f..8fda3c1c86c60 100644 --- a/src/test/ui/moves/move-2-unique.rs +++ b/src/test/ui/moves/move-2-unique.rs @@ -1,11 +1,10 @@ // run-pass #![allow(dead_code)] -#![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 x: Box<_> = Box::new(X {x: 1, y: 2, z: 3}); let y = x; assert_eq!(y.y, 2); } diff --git a/src/test/ui/moves/move-2.rs b/src/test/ui/moves/move-2.rs index 4ad53e96e50f2..5e010087465d9 100644 --- a/src/test/ui/moves/move-2.rs +++ b/src/test/ui/moves/move-2.rs @@ -1,7 +1,6 @@ // run-pass #![allow(dead_code)] -#![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); } +pub fn main() { let x: Box<_> = Box::new(X {x: 1, y: 2, z: 3}); let y = x; assert_eq!(y.y, 2); } diff --git a/src/test/ui/moves/move-3-unique.rs b/src/test/ui/moves/move-3-unique.rs index d23a852433f4f..8e5df2c3ff9fd 100644 --- a/src/test/ui/moves/move-3-unique.rs +++ b/src/test/ui/moves/move-3-unique.rs @@ -1,7 +1,6 @@ // run-pass #![allow(unused_mut)] #![allow(dead_code)] -#![feature(box_syntax)] #[derive(Clone)] struct Triple { @@ -13,12 +12,12 @@ struct Triple { 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}; } + if x { y = bar; } else { y = Box::new(Triple {x: 4, y: 5, z: 6}); } return y.y; } pub fn main() { - let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; + let x: Box<_> = Box::new(Triple{x: 1, y: 2, z: 3}); for _ in 0_usize..10000_usize { assert_eq!(test(true, x.clone()), 2); } diff --git a/src/test/ui/moves/move-4-unique.rs b/src/test/ui/moves/move-4-unique.rs index 1787caadb7ab0..24aec7ea62c8b 100644 --- a/src/test/ui/moves/move-4-unique.rs +++ b/src/test/ui/moves/move-4-unique.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] struct Triple {a: isize, b: isize, c: isize} @@ -13,7 +12,7 @@ fn test(foo: Box) -> Box { } pub fn main() { - let x = box Triple{a: 1, b: 2, c: 3}; + let x = Box::new(Triple{a: 1, b: 2, c: 3}); let y = test(x); assert_eq!(y.c, 3); } diff --git a/src/test/ui/moves/move-4.rs b/src/test/ui/moves/move-4.rs index c87c605df7730..63aa031a66e60 100644 --- a/src/test/ui/moves/move-4.rs +++ b/src/test/ui/moves/move-4.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] struct Triple { a: isize, b: isize, c: isize } @@ -13,7 +12,7 @@ fn test(foo: Box) -> Box { } pub fn main() { - let x = box Triple{a: 1, b: 2, c: 3}; + let x = Box::new(Triple{ a: 1, b: 2, c: 3 }); let y = test(x); assert_eq!(y.c, 3); } diff --git a/src/test/ui/moves/move-arg-2-unique.rs b/src/test/ui/moves/move-arg-2-unique.rs index fcfd5e14765f5..9622c83750d3e 100644 --- a/src/test/ui/moves/move-arg-2-unique.rs +++ b/src/test/ui/moves/move-arg-2-unique.rs @@ -1,13 +1,12 @@ // run-pass -#![feature(box_syntax)] fn test(foo: Box> ) { assert_eq!((*foo)[0], 10); } pub fn main() { - let x = box vec![10]; + let x = Box::new(vec![10]); // Test forgetting a local by move-in test(x); // Test forgetting a temporary by move-in. - test(box vec![10]); + test(Box::new(vec![10])); } diff --git a/src/test/ui/moves/move-arg-2.rs b/src/test/ui/moves/move-arg-2.rs index 4cd1f6fe8105e..77ee06e192e73 100644 --- a/src/test/ui/moves/move-arg-2.rs +++ b/src/test/ui/moves/move-arg-2.rs @@ -1,13 +1,12 @@ // run-pass -#![feature(box_syntax)] fn test(foo: Box>) { assert_eq!((*foo)[0], 10); } pub fn main() { - let x = box vec![10]; + let x = Box::new(vec![10]); // Test forgetting a local by move-in test(x); // Test forgetting a temporary by move-in. - test(box vec![10]); + test(Box::new(vec![10])); } diff --git a/src/test/ui/moves/move-guard-same-consts.rs b/src/test/ui/moves/move-guard-same-consts.rs index da436b89f538e..b96ef8e19eb51 100644 --- a/src/test/ui/moves/move-guard-same-consts.rs +++ b/src/test/ui/moves/move-guard-same-consts.rs @@ -8,10 +8,10 @@ // that assumption did not hold, at least not in the long run (namely, // overlapping patterns were turned into warnings rather than errors). -#![feature(box_syntax)] + fn main() { - let x: Box<_> = box 1; + let x: Box<_> = Box::new(1); let v = (1, 2); diff --git a/src/test/ui/moves/move-guard-same-consts.stderr b/src/test/ui/moves/move-guard-same-consts.stderr index 5fc8a5499326e..2048fefefa31b 100644 --- a/src/test/ui/moves/move-guard-same-consts.stderr +++ b/src/test/ui/moves/move-guard-same-consts.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` --> $DIR/move-guard-same-consts.rs:20:24 | -LL | let x: Box<_> = box 1; +LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait ... LL | (1, 2) if take(x) => (), diff --git a/src/test/ui/moves/move-in-guard-1.rs b/src/test/ui/moves/move-in-guard-1.rs index 9c50782e6406c..36e39fea6af3b 100644 --- a/src/test/ui/moves/move-in-guard-1.rs +++ b/src/test/ui/moves/move-in-guard-1.rs @@ -1,7 +1,7 @@ -#![feature(box_syntax)] - pub fn main() { - let x: Box<_> = box 1; + + + let x: Box<_> = Box::new(1); let v = (1, 2); diff --git a/src/test/ui/moves/move-in-guard-1.stderr b/src/test/ui/moves/move-in-guard-1.stderr index d894209f51764..5e9aa66b90dae 100644 --- a/src/test/ui/moves/move-in-guard-1.stderr +++ b/src/test/ui/moves/move-in-guard-1.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` --> $DIR/move-in-guard-1.rs:10:24 | -LL | let x: Box<_> = box 1; +LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait ... LL | (1, _) if take(x) => (), diff --git a/src/test/ui/moves/move-in-guard-2.rs b/src/test/ui/moves/move-in-guard-2.rs index f478625a83b3e..085b7ec6e0ccc 100644 --- a/src/test/ui/moves/move-in-guard-2.rs +++ b/src/test/ui/moves/move-in-guard-2.rs @@ -1,7 +1,5 @@ -#![feature(box_syntax)] - pub fn main() { - let x: Box<_> = box 1; + let x: Box<_> = Box::new(1); let v = (1, 2); diff --git a/src/test/ui/moves/move-in-guard-2.stderr b/src/test/ui/moves/move-in-guard-2.stderr index a067d43389378..ea350926b1519 100644 --- a/src/test/ui/moves/move-in-guard-2.stderr +++ b/src/test/ui/moves/move-in-guard-2.stderr @@ -1,7 +1,7 @@ error[E0382]: use of moved value: `x` - --> $DIR/move-in-guard-2.rs:10:24 + --> $DIR/move-in-guard-2.rs:8:24 | -LL | let x: Box<_> = box 1; +LL | let x: Box<_> = Box::new(1); | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait ... LL | (_, 2) if take(x) => (), diff --git a/src/test/ui/moves/move-out-of-tuple-field.rs b/src/test/ui/moves/move-out-of-tuple-field.rs index e5a505bb88d32..66912fa4d0998 100644 --- a/src/test/ui/moves/move-out-of-tuple-field.rs +++ b/src/test/ui/moves/move-out-of-tuple-field.rs @@ -1,13 +1,13 @@ -#![feature(box_syntax)] - struct Foo(Box); + + fn main() { - let x: (Box<_>,) = (box 1,); + let x: (Box<_>,) = (Box::new(1),); let y = x.0; let z = x.0; //~ ERROR use of moved value: `x.0` - let x = Foo(box 1); + let x = Foo(Box::new(1)); let y = x.0; let z = x.0; //~ ERROR use of moved value: `x.0` } diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.rs b/src/test/ui/moves/moves-based-on-type-block-bad.rs index 085e249c0fb07..eca33167f454a 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.rs +++ b/src/test/ui/moves/moves-based-on-type-block-bad.rs @@ -1,5 +1,5 @@ #![feature(box_patterns)] -#![feature(box_syntax)] + struct S { x: Box @@ -16,7 +16,7 @@ fn f(s: &S, g: G) where G: FnOnce(&S) { } fn main() { - let s = S { x: box E::Bar(box 42) }; + let s = S { x: Box::new(E::Bar(Box::new(42))) }; loop { f(&s, |hellothere| { match hellothere.x { //~ ERROR cannot move out diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs index 52a5103865123..76b7aab542de8 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax, unboxed_closures)] +#![feature(unboxed_closures)] fn to_fn>(f: F) -> F { f } fn test(_x: Box) {} fn main() { - let i = box 3; + let i = Box::new(3); let _f = to_fn(|| test(i)); //~ ERROR cannot move out } diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr index e12af2d452743..ce930eee2e919 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr @@ -1,7 +1,7 @@ error[E0507]: cannot move out of `i`, a captured variable in an `Fn` closure --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:9:28 | -LL | let i = box 3; +LL | let i = Box::new(3); | - captured outer variable LL | let _f = to_fn(|| test(i)); | --------^- diff --git a/src/test/ui/moves/moves-based-on-type-tuple.rs b/src/test/ui/moves/moves-based-on-type-tuple.rs index 828d90cd7ac7f..2e67d8f8a6913 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.rs +++ b/src/test/ui/moves/moves-based-on-type-tuple.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax)] - fn dup(x: Box) -> Box<(Box,Box)> { - box (x, x) + + + Box::new((x, x)) //~^ use of moved value: `x` [E0382] } fn main() { - dup(box 3); + dup(Box::new(3)); } diff --git a/src/test/ui/moves/moves-based-on-type-tuple.stderr b/src/test/ui/moves/moves-based-on-type-tuple.stderr index a52c023e20293..eef8ce61fa9d8 100644 --- a/src/test/ui/moves/moves-based-on-type-tuple.stderr +++ b/src/test/ui/moves/moves-based-on-type-tuple.stderr @@ -1,12 +1,13 @@ error[E0382]: use of moved value: `x` - --> $DIR/moves-based-on-type-tuple.rs:4:13 + --> $DIR/moves-based-on-type-tuple.rs:4:18 | LL | fn dup(x: Box) -> Box<(Box,Box)> { | - move occurs because `x` has type `Box`, which does not implement the `Copy` trait -LL | box (x, x) - | - ^ value used here after move - | | - | value moved here +... +LL | Box::new((x, x)) + | - ^ value used here after move + | | + | value moved here error: aborting due to previous error diff --git a/src/test/ui/moves/moves-sru-moved-field.rs b/src/test/ui/moves/moves-sru-moved-field.rs index e620e5de92320..72957c49fc8ae 100644 --- a/src/test/ui/moves/moves-sru-moved-field.rs +++ b/src/test/ui/moves/moves-sru-moved-field.rs @@ -1,7 +1,7 @@ -#![feature(box_syntax)] - type Noncopyable = Box; + + struct Foo { copied: isize, moved: Box, @@ -10,8 +10,8 @@ struct Foo { fn test0(f: Foo, g: Noncopyable, h: Noncopyable) { // just copy implicitly copyable fields from `f`, no moves: - let _b = Foo {moved: box 1, noncopyable: g, ..f}; - let _c = Foo {moved: box 2, noncopyable: h, ..f}; + let _b = Foo {moved: Box::new(1), noncopyable: g, ..f}; + let _c = Foo {moved: Box::new(2), noncopyable: h, ..f}; } fn test1(f: Foo, g: Noncopyable, h: Noncopyable) { diff --git a/src/test/ui/mut-function-arguments.rs b/src/test/ui/mut-function-arguments.rs index 620d00edbbce3..1e682fc4b66c4 100644 --- a/src/test/ui/mut-function-arguments.rs +++ b/src/test/ui/mut-function-arguments.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(box_syntax)] - fn f(mut y: Box) { *y = 5; assert_eq!(*y, 5); @@ -9,13 +7,13 @@ fn f(mut y: Box) { fn g() { let frob = |mut q: Box| { *q = 2; assert_eq!(*q, 2); }; - let w = box 37; + let w = Box::new(37); frob(w); } pub fn main() { - let z = box 17; + let z = Box::new(17); f(z); g(); } diff --git a/src/test/ui/mut/mut-cross-borrowing.rs b/src/test/ui/mut/mut-cross-borrowing.rs index 63e49c292eac7..080faab732619 100644 --- a/src/test/ui/mut/mut-cross-borrowing.rs +++ b/src/test/ui/mut/mut-cross-borrowing.rs @@ -1,8 +1,8 @@ -#![feature(box_syntax)] - fn f(_: &mut isize) {} fn main() { - let mut x: Box<_> = box 3; + + let mut x: Box<_> = Box::new(3); + f(x) //~ ERROR mismatched types } diff --git a/src/test/ui/new-box-syntax.rs b/src/test/ui/new-box-syntax.rs index 418cf554b49be..c56e1dd46254f 100644 --- a/src/test/ui/new-box-syntax.rs +++ b/src/test/ui/new-box-syntax.rs @@ -5,7 +5,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ #![allow(dead_code, unused_variables)] -#![feature(box_syntax)] // Tests that the new `box` syntax works with unique pointers. @@ -17,12 +16,12 @@ struct Structure { } pub fn main() { - let y: Box = box 2; - let b: Box = box (1 + 2); - let c = box (3 + 4); + let y: Box = Box::new(2); + let b: Box = Box::new(1 + 2); + let c = Box::new(3 + 4); - let s: Box = box Structure { + let s: Box = Box::new(Structure { x: 3, y: 4, - }; + }); } diff --git a/src/test/ui/new-box.rs b/src/test/ui/new-box.rs index d11f0d045a7e4..96a3b197f461c 100644 --- a/src/test/ui/new-box.rs +++ b/src/test/ui/new-box.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(box_syntax)] - fn f(x: Box) { let y: &isize = &*x; println!("{}", *x); @@ -27,6 +25,6 @@ fn g(x: Box) { } fn main() { - f(box 1234); - g(box Struct as Box); + f(Box::new(1234)); + g(Box::new(Struct) as Box); } diff --git a/src/test/ui/nll/issue-52663-trait-object.rs b/src/test/ui/nll/issue-52663-trait-object.rs index a7be365bde4bd..f6bbb2d14b003 100644 --- a/src/test/ui/nll/issue-52663-trait-object.rs +++ b/src/test/ui/nll/issue-52663-trait-object.rs @@ -1,16 +1,16 @@ -#![feature(box_syntax)] - trait Foo { fn get(&self); } impl Foo for A { fn get(&self) { } } + + fn main() { let _ = { let tmp0 = 3; let tmp1 = &tmp0; - box tmp1 as Box + Box::new(tmp1) as Box }; //~^^^ ERROR `tmp0` does not live long enough } diff --git a/src/test/ui/nll/issue-52663-trait-object.stderr b/src/test/ui/nll/issue-52663-trait-object.stderr index 9e09251901583..5cedea6e66520 100644 --- a/src/test/ui/nll/issue-52663-trait-object.stderr +++ b/src/test/ui/nll/issue-52663-trait-object.stderr @@ -3,8 +3,8 @@ error[E0597]: `tmp0` does not live long enough | LL | let tmp1 = &tmp0; | ^^^^^ borrowed value does not live long enough -LL | box tmp1 as Box - | ----------------------------- borrow later used here +LL | Box::new(tmp1) as Box + | ----------------------------------- borrow later captured here by trait object LL | }; | - `tmp0` dropped here while still borrowed diff --git a/src/test/ui/nullable-pointer-iotareduction.rs b/src/test/ui/nullable-pointer-iotareduction.rs index 568c3e144be2c..f9edba6743499 100644 --- a/src/test/ui/nullable-pointer-iotareduction.rs +++ b/src/test/ui/nullable-pointer-iotareduction.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(box_syntax)] - // Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions, // which "says that a destructor applied to an object built from a constructor // behaves as expected". -- https://coq.inria.fr/doc/language/core/conversion.html#iota-reduction @@ -64,7 +62,7 @@ macro_rules! check_type { pub fn main() { check_type!(&17, &isize); - check_type!(box 18, Box); + check_type!(Box::new(18), Box); check_type!("foo".to_string(), String); check_type!(vec![20, 22], Vec); check_type!(main, fn(), |pthing| { diff --git a/src/test/ui/objects-owned-object-borrowed-method-headerless.rs b/src/test/ui/objects-owned-object-borrowed-method-headerless.rs index 9b88d8ea7bcd9..fce1341fc7415 100644 --- a/src/test/ui/objects-owned-object-borrowed-method-headerless.rs +++ b/src/test/ui/objects-owned-object-borrowed-method-headerless.rs @@ -3,9 +3,6 @@ // closed over do not contain managed values, and thus the boxes do // not have headers. -#![feature(box_syntax)] - - trait FooTrait { fn foo(&self) -> usize; } @@ -22,9 +19,9 @@ impl FooTrait for BarStruct { pub fn main() { let foos: Vec> = vec![ - box BarStruct{ x: 0 } as Box, - box BarStruct{ x: 1 } as Box, - box BarStruct{ x: 2 } as Box + Box::new(BarStruct{ x: 0 }) as Box, + Box::new(BarStruct{ x: 1 }) as Box, + Box::new(BarStruct{ x: 2 }) as Box, ]; for i in 0..foos.len() { diff --git a/src/test/ui/objects-owned-object-owned-method.rs b/src/test/ui/objects-owned-object-owned-method.rs index 4b7b68f22176f..15677a5185c2f 100644 --- a/src/test/ui/objects-owned-object-owned-method.rs +++ b/src/test/ui/objects-owned-object-owned-method.rs @@ -3,8 +3,6 @@ // closed over contain managed values. This implies that the boxes // will have headers that must be skipped over. -#![feature(box_syntax)] - trait FooTrait { fn foo(self: Box) -> usize; } @@ -20,6 +18,6 @@ impl FooTrait for BarStruct { } pub fn main() { - let foo = box BarStruct{ x: 22 } as Box; + let foo = Box::new(BarStruct{ x: 22 }) as Box; assert_eq!(22, foo.foo()); } diff --git a/src/test/ui/occurs-check-2.rs b/src/test/ui/occurs-check-2.rs index 213fd2619cee7..f36682a3dd821 100644 --- a/src/test/ui/occurs-check-2.rs +++ b/src/test/ui/occurs-check-2.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax)] - fn main() { + let f; let g; + g = f; - f = box g; + f = Box::new(g); //~^ ERROR mismatched types //~| cyclic type of infinite size } diff --git a/src/test/ui/occurs-check-2.stderr b/src/test/ui/occurs-check-2.stderr index c004043307899..dcbfc81b4d519 100644 --- a/src/test/ui/occurs-check-2.stderr +++ b/src/test/ui/occurs-check-2.stderr @@ -1,13 +1,10 @@ error[E0308]: mismatched types --> $DIR/occurs-check-2.rs:7:9 | -LL | f = box g; - | ^^^^^ cyclic type of infinite size - | -help: try using a conversion method - | -LL | f = (box g).to_string(); - | + +++++++++++++ +LL | f = Box::new(g); + | ^^^^^^^^^^^- help: try using a conversion method: `.to_string()` + | | + | cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/occurs-check.rs b/src/test/ui/occurs-check.rs index 5f2c2362d24cd..aec52d839766a 100644 --- a/src/test/ui/occurs-check.rs +++ b/src/test/ui/occurs-check.rs @@ -1,8 +1,8 @@ -#![feature(box_syntax)] - fn main() { + let f; - f = box f; + + f = Box::new(f); //~^ ERROR mismatched types //~| cyclic type of infinite size } diff --git a/src/test/ui/occurs-check.stderr b/src/test/ui/occurs-check.stderr index 452163e2fa5ee..3e1ef2e719ad5 100644 --- a/src/test/ui/occurs-check.stderr +++ b/src/test/ui/occurs-check.stderr @@ -1,13 +1,10 @@ error[E0308]: mismatched types --> $DIR/occurs-check.rs:5:9 | -LL | f = box f; - | ^^^^^ cyclic type of infinite size - | -help: try using a conversion method - | -LL | f = (box f).to_string(); - | + +++++++++++++ +LL | f = Box::new(f); + | ^^^^^^^^^^^- help: try using a conversion method: `.to_string()` + | | + | cyclic type of infinite size error: aborting due to previous error diff --git a/src/test/ui/output-slot-variants.rs b/src/test/ui/output-slot-variants.rs index af4caf7566996..7c20a2b2f94e8 100644 --- a/src/test/ui/output-slot-variants.rs +++ b/src/test/ui/output-slot-variants.rs @@ -7,22 +7,21 @@ #![allow(dead_assignment)] #![allow(unused_variables)] -#![feature(box_syntax)] struct A { a: isize, b: isize } struct Abox { a: Box, b: Box } fn ret_int_i() -> isize { 10 } -fn ret_ext_i() -> Box { box 10 } +fn ret_ext_i() -> Box { Box::new(10) } fn ret_int_rec() -> A { A {a: 10, b: 10} } -fn ret_ext_rec() -> Box { box A {a: 10, b: 10} } +fn ret_ext_rec() -> Box { Box::new(A {a: 10, b: 10}) } -fn ret_ext_mem() -> Abox { Abox {a: box 10, b: box 10} } +fn ret_ext_mem() -> Abox { Abox {a: Box::new(10), b: Box::new(10) } } -fn ret_ext_ext_mem() -> Box { box Abox{a: box 10, b: box 10} } +fn ret_ext_ext_mem() -> Box { Box::new(Abox{a: Box::new(10), b: Box::new(10) }) } pub fn main() { let mut int_i: isize; diff --git a/src/test/ui/overloaded/overloaded-autoderef.rs b/src/test/ui/overloaded/overloaded-autoderef.rs index e850633e34fee..cae3ec906211e 100644 --- a/src/test/ui/overloaded/overloaded-autoderef.rs +++ b/src/test/ui/overloaded/overloaded-autoderef.rs @@ -2,8 +2,6 @@ #![allow(unused_variables)] #![allow(stable_features)] -#![feature(box_syntax, core)] - use std::cell::RefCell; use std::rc::Rc; @@ -14,7 +12,7 @@ struct Point { } pub fn main() { - let box_5: Box<_> = box 5_usize; + let box_5: Box<_> = Box::new(5_usize); let point = Rc::new(Point {x: 2, y: 4}); assert_eq!(point.x, 2); assert_eq!(point.y, 4); diff --git a/src/test/ui/overloaded/overloaded-index-autoderef.rs b/src/test/ui/overloaded/overloaded-index-autoderef.rs index 6996ee32933c0..41f9efa8c1619 100644 --- a/src/test/ui/overloaded/overloaded-index-autoderef.rs +++ b/src/test/ui/overloaded/overloaded-index-autoderef.rs @@ -3,8 +3,6 @@ // Test overloaded indexing combined with autoderef. -#![feature(box_syntax, core)] - use std::ops::{Index, IndexMut}; struct Foo { @@ -47,10 +45,10 @@ impl Int for isize { } fn main() { - let mut f: Box<_> = box Foo { + let mut f: Box<_> = Box::new(Foo { x: 1, y: 2, - }; + }); assert_eq!(f[1], 2); diff --git a/src/test/ui/panics/args-panic.rs b/src/test/ui/panics/args-panic.rs index 322054caf1161..7636025c25b83 100644 --- a/src/test/ui/panics/args-panic.rs +++ b/src/test/ui/panics/args-panic.rs @@ -2,12 +2,10 @@ // error-pattern:meep // ignore-emscripten no processes -#![feature(box_syntax)] - fn f(_a: isize, _b: isize, _c: Box) { panic!("moop"); } fn main() { - f(1, panic!("meep"), box 42); + f(1, panic!("meep"), Box::new(42)); } diff --git a/src/test/ui/panics/panic-macro-any.rs b/src/test/ui/panics/panic-macro-any.rs index 08acc6e8078f9..c7df5365474e9 100644 --- a/src/test/ui/panics/panic-macro-any.rs +++ b/src/test/ui/panics/panic-macro-any.rs @@ -2,9 +2,8 @@ // error-pattern:panicked at 'Box' // ignore-emscripten no processes -#![feature(box_syntax)] #![allow(non_fmt_panics)] fn main() { - panic!(box 413 as Box); + panic!(Box::new(413) as Box); } diff --git a/src/test/ui/parser/trailing-plus-in-bounds.rs b/src/test/ui/parser/trailing-plus-in-bounds.rs index 33c30d7310877..61819cabdf178 100644 --- a/src/test/ui/parser/trailing-plus-in-bounds.rs +++ b/src/test/ui/parser/trailing-plus-in-bounds.rs @@ -1,10 +1,9 @@ // build-pass (FIXME(62277): could be check-pass?) -#![feature(box_syntax)] #![allow(bare_trait_objects)] use std::fmt::Debug; fn main() { - let x: Box = box 3 as Box; // Trailing `+` is OK + let x: Box = Box::new(3) as Box; // Trailing `+` is OK } diff --git a/src/test/ui/pattern/usefulness/issue-12116.rs b/src/test/ui/pattern/usefulness/issue-12116.rs index 8b391cd95d7f7..3cb92a54029dc 100644 --- a/src/test/ui/pattern/usefulness/issue-12116.rs +++ b/src/test/ui/pattern/usefulness/issue-12116.rs @@ -1,9 +1,9 @@ #![feature(box_patterns)] -#![feature(box_syntax)] #![allow(dead_code)] #![allow(unused_variables)] #![deny(unreachable_patterns)] + enum IntList { Cons(isize, Box), Nil @@ -12,9 +12,9 @@ enum IntList { fn tail(source_list: &IntList) -> IntList { match source_list { &IntList::Cons(val, box ref next_list) => tail(next_list), - &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil), -//~^ ERROR unreachable pattern - _ => panic!() + &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)), + //~^ ERROR unreachable pattern + _ => panic!(), } } diff --git a/src/test/ui/pattern/usefulness/issue-12116.stderr b/src/test/ui/pattern/usefulness/issue-12116.stderr index 4d162eb77e725..7f15c4703a31c 100644 --- a/src/test/ui/pattern/usefulness/issue-12116.stderr +++ b/src/test/ui/pattern/usefulness/issue-12116.stderr @@ -1,11 +1,11 @@ error: unreachable pattern --> $DIR/issue-12116.rs:15:9 | -LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, box IntList::Nil), +LL | &IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: the lint level is defined here - --> $DIR/issue-12116.rs:5:9 + --> $DIR/issue-12116.rs:4:9 | LL | #![deny(unreachable_patterns)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/pattern/usefulness/issue-3601.rs b/src/test/ui/pattern/usefulness/issue-3601.rs index e33359beccdef..6215a23980d6d 100644 --- a/src/test/ui/pattern/usefulness/issue-3601.rs +++ b/src/test/ui/pattern/usefulness/issue-3601.rs @@ -1,5 +1,4 @@ #![feature(box_patterns)] -#![feature(box_syntax)] struct HTMLImageData { image: Option @@ -23,8 +22,9 @@ struct NodeData { fn main() { let mut id = HTMLImageData { image: None }; - let ed = ElementData { kind: box ElementKind::HTMLImageElement(id) }; - let n = NodeData {kind : box NodeKind::Element(ed)}; + let ed = ElementData { kind: Box::new(ElementKind::HTMLImageElement(id)) }; + let n = NodeData { kind: Box::new(NodeKind::Element(ed)) }; + // n.b. span could be better match n.kind { box NodeKind::Element(ed) => match ed.kind { //~ ERROR non-exhaustive patterns diff --git a/src/test/ui/pure-sum.rs b/src/test/ui/pure-sum.rs index 2ff6f935a03c1..2f2ece75ebeeb 100644 --- a/src/test/ui/pure-sum.rs +++ b/src/test/ui/pure-sum.rs @@ -5,8 +5,6 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - fn sums_to(v: Vec , sum: isize) -> bool { let mut i = 0; let mut sum0 = 0; @@ -19,7 +17,7 @@ fn sums_to(v: Vec , sum: isize) -> bool { fn sums_to_using_uniq(v: Vec , sum: isize) -> bool { let mut i = 0; - let mut sum0: Box<_> = box 0; + let mut sum0: Box<_> = 0.into(); while i < v.len() { *sum0 += v[i]; i += 1; @@ -41,7 +39,7 @@ struct F { f: T } fn sums_to_using_uniq_rec(v: Vec , sum: isize) -> bool { let mut i = 0; - let mut sum0 = F::> {f: box 0}; + let mut sum0 = F::> {f: 0.into() }; while i < v.len() { *sum0.f += v[i]; i += 1; diff --git a/src/test/ui/rcvr-borrowed-to-region.rs b/src/test/ui/rcvr-borrowed-to-region.rs index 37113bc0a050b..7f32b8b91a6f0 100644 --- a/src/test/ui/rcvr-borrowed-to-region.rs +++ b/src/test/ui/rcvr-borrowed-to-region.rs @@ -1,7 +1,6 @@ // run-pass #![allow(non_camel_case_types)] -#![feature(box_syntax)] trait get { fn get(self) -> isize; @@ -17,7 +16,7 @@ impl<'a> get for &'a isize { } pub fn main() { - let x: Box<_> = box 6; + let x: Box<_> = 6.into(); let y = x.get(); println!("y={}", y); assert_eq!(y, 6); diff --git a/src/test/ui/reachable/expr_again.rs b/src/test/ui/reachable/expr_again.rs index 243fed0c8ce52..6049321337c75 100644 --- a/src/test/ui/reachable/expr_again.rs +++ b/src/test/ui/reachable/expr_again.rs @@ -1,5 +1,5 @@ -#![feature(box_syntax)] #![allow(unused_variables)] + #![deny(unreachable_code)] fn main() { diff --git a/src/test/ui/reachable/unreachable-arm.rs b/src/test/ui/reachable/unreachable-arm.rs index 64c3896851669..3277bf0d52b20 100644 --- a/src/test/ui/reachable/unreachable-arm.rs +++ b/src/test/ui/reachable/unreachable-arm.rs @@ -1,5 +1,5 @@ #![feature(box_patterns)] -#![feature(box_syntax)] + #![allow(dead_code)] #![deny(unreachable_patterns)] diff --git a/src/test/ui/regions/issue-12470.rs b/src/test/ui/regions/issue-12470.rs index 0ade359923a0e..d8f2abb0c3c21 100644 --- a/src/test/ui/regions/issue-12470.rs +++ b/src/test/ui/regions/issue-12470.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax)] - trait X { fn get_i(&self) -> isize; } + + struct B { i: isize } @@ -24,7 +24,7 @@ fn make_a<'a>(p: &'a dyn X) -> A<'a> { } fn make_make_a<'a>() -> A<'a> { - let b: Box = box B {i:1}; + let b: Box = Box::new(B { i: 1 }); let bb: &B = &*b; make_a(bb) //~ ERROR cannot return value referencing local data `*b` } diff --git a/src/test/ui/regions/regions-borrow-at.rs b/src/test/ui/regions/regions-borrow-at.rs index 355e8c914551c..152abe109bca4 100644 --- a/src/test/ui/regions/regions-borrow-at.rs +++ b/src/test/ui/regions/regions-borrow-at.rs @@ -1,12 +1,11 @@ // run-pass -#![feature(box_syntax)] fn foo(x: &usize) -> usize { *x } pub fn main() { - let p: Box<_> = box 22; + let p: Box<_> = Box::new(22); let r = foo(&*p); println!("r={}", r); assert_eq!(r, 22); diff --git a/src/test/ui/regions/regions-borrow-uniq.rs b/src/test/ui/regions/regions-borrow-uniq.rs index 3bf049c151137..adc6b1939da7f 100644 --- a/src/test/ui/regions/regions-borrow-uniq.rs +++ b/src/test/ui/regions/regions-borrow-uniq.rs @@ -1,12 +1,11 @@ // run-pass -#![feature(box_syntax)] fn foo(x: &usize) -> usize { *x } pub fn main() { - let p: Box<_> = box 3; + let p: Box<_> = Box::new(3); let r = foo(&*p); assert_eq!(r, 3); } diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs index 0cbdc828c507f..428477e24899a 100644 --- a/src/test/ui/regions/regions-close-associated-type-into-object.rs +++ b/src/test/ui/regions/regions-close-associated-type-into-object.rs @@ -1,7 +1,7 @@ -#![feature(box_syntax)] - trait X {} + + trait Iter { type Item: X; @@ -18,7 +18,7 @@ fn bad1(v: T) -> Box fn bad2(v: T) -> Box where Box : X { - let item: Box<_> = box v.into_item(); + let item: Box<_> = Box::new(v.into_item()); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } @@ -31,7 +31,7 @@ fn bad3<'a, T: Iter>(v: T) -> Box fn bad4<'a, T: Iter>(v: T) -> Box where Box : X { - let item: Box<_> = box v.into_item(); + let item: Box<_> = Box::new(v.into_item()); Box::new(item) //~ ERROR associated type `::Item` may not live long enough } diff --git a/src/test/ui/regions/regions-close-object-into-object-1.rs b/src/test/ui/regions/regions-close-object-into-object-1.rs index 5518c6a94b1d0..2dc33d5671ff0 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.rs +++ b/src/test/ui/regions/regions-close-object-into-object-1.rs @@ -1,7 +1,7 @@ -#![feature(box_syntax)] #![allow(warnings)] trait A { } + struct B<'a, T:'a>(&'a (A+'a)); trait X { } @@ -9,7 +9,7 @@ trait X { } impl<'a, T> X for B<'a, T> {} fn f<'a, T:'static, U>(v: Box+'static>) -> Box { - box B(&*v) as Box //~ ERROR cannot return value referencing local data `*v` + Box::new(B(&*v)) as Box //~ ERROR cannot return value referencing local data `*v` } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-1.stderr b/src/test/ui/regions/regions-close-object-into-object-1.stderr index 8e119c4f5355f..5bfaeb295c352 100644 --- a/src/test/ui/regions/regions-close-object-into-object-1.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-1.stderr @@ -1,10 +1,10 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-1.rs:12:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ - | | | - | | `*v` is borrowed here +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^---^^^^^^^^^^^^ + | | | + | | `*v` is borrowed here | returns a value referencing data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr index 882faf4ece316..410fab962f720 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr @@ -1,20 +1,20 @@ error: lifetime may not live long enough - --> $DIR/regions-close-object-into-object-2.rs:10:5 + --> $DIR/regions-close-object-into-object-2.rs:9:5 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | -- lifetime `'a` defined here -LL | box B(&*v) as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` | = help: consider replacing `'a` with `'static` error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-2.rs:10:5 + --> $DIR/regions-close-object-into-object-2.rs:9:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^^^^^ - | | | - | | `*v` is borrowed here +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ + | | | + | | `*v` is borrowed here | returns a value referencing data owned by the current function error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs index 7144ab5a24c51..9c41174e24d8d 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.rs +++ b/src/test/ui/regions/regions-close-object-into-object-2.rs @@ -1,13 +1,12 @@ -#![feature(box_syntax)] - trait A { } + struct B<'a, T:'a>(&'a (dyn A + 'a)); trait X { } impl<'a, T> X for B<'a, T> {} fn g<'a, T: 'static>(v: Box + 'a>) -> Box { - box B(&*v) as Box //~ ERROR E0759 + Box::new(B(&*v)) as Box //~ ERROR E0759 } fn main() { } diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr index 78d2371cf53b2..9a7df8c0188b1 100644 --- a/src/test/ui/regions/regions-close-object-into-object-2.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr @@ -1,10 +1,10 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-close-object-into-object-2.rs:10:11 + --> $DIR/regions-close-object-into-object-2.rs:9:16 | LL | fn g<'a, T: 'static>(v: Box + 'a>) -> Box { | ------------------ this data with lifetime `'a`... -LL | box B(&*v) as Box - | ^^^ ...is captured here, requiring it to live as long as `'static` +LL | Box::new(B(&*v)) as Box + | ^^^ ...is captured here, requiring it to live as long as `'static` | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | diff --git a/src/test/ui/regions/regions-close-object-into-object-3.rs b/src/test/ui/regions/regions-close-object-into-object-3.rs index 6f6b3a170027d..78d93b0ece5b6 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.rs +++ b/src/test/ui/regions/regions-close-object-into-object-3.rs @@ -1,14 +1,14 @@ -#![feature(box_syntax)] #![allow(warnings)] trait A { } + struct B<'a, T:'a>(&'a (A+'a)); trait X { } impl<'a, T> X for B<'a, T> {} fn h<'a, T, U:'static>(v: Box+'static>) -> Box { - box B(&*v) as Box //~ ERROR cannot return value referencing local data `*v` + Box::new(B(&*v)) as Box //~ ERROR cannot return value referencing local data `*v` } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-3.stderr b/src/test/ui/regions/regions-close-object-into-object-3.stderr index 9ea13638f5cad..9f92c40e1e18d 100644 --- a/src/test/ui/regions/regions-close-object-into-object-3.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-3.stderr @@ -1,10 +1,10 @@ error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-3.rs:11:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ - | | | - | | `*v` is borrowed here +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^---^^^^^^^^^^^^ + | | | + | | `*v` is borrowed here | returns a value referencing data owned by the current function error: aborting due to previous error diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr index 93ac17810dae2..e2cd864ea020e 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr @@ -1,39 +1,55 @@ error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:10:5 + --> $DIR/regions-close-object-into-object-4.rs:9:5 | -LL | box B(&*v) as Box - | ^^^^^^^^^^ +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `U: 'static`... + +error[E0310]: the parameter type `U` may not live long enough + --> $DIR/regions-close-object-into-object-4.rs:9:5 + | +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `U: 'static`... + +error[E0310]: the parameter type `U` may not live long enough + --> $DIR/regions-close-object-into-object-4.rs:9:5 + | +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `U: 'static`... error: lifetime may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:10:5 + --> $DIR/regions-close-object-into-object-4.rs:9:5 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | -- lifetime `'a` defined here -LL | box B(&*v) as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static` | = help: consider replacing `'a` with `'static` error[E0515]: cannot return value referencing local data `*v` - --> $DIR/regions-close-object-into-object-4.rs:10:5 + --> $DIR/regions-close-object-into-object-4.rs:9:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^^^^^ - | | | - | | `*v` is borrowed here +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ + | | | + | | `*v` is borrowed here | returns a value referencing data owned by the current function error[E0310]: the parameter type `U` may not live long enough - --> $DIR/regions-close-object-into-object-4.rs:10:9 + --> $DIR/regions-close-object-into-object-4.rs:9:14 | -LL | box B(&*v) as Box - | ^^^^^^ +LL | Box::new(B(&*v)) as Box + | ^^^^^^ | = help: consider adding an explicit lifetime bound `U: 'static`... -error: aborting due to 4 previous errors +error: aborting due to 6 previous errors Some errors have detailed explanations: E0310, E0515. For more information about an error, try `rustc --explain E0310`. diff --git a/src/test/ui/regions/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs index 4c087f264f92b..2a06a2b7c0513 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.rs +++ b/src/test/ui/regions/regions-close-object-into-object-4.rs @@ -1,13 +1,12 @@ -#![feature(box_syntax)] - trait A { } + struct B<'a, T:'a>(&'a (dyn A + 'a)); trait X { } impl<'a, T> X for B<'a, T> {} fn i<'a, T, U>(v: Box+'a>) -> Box { - box B(&*v) as Box //~ ERROR E0759 + Box::new(B(&*v)) as Box //~ ERROR E0759 } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr index 8c94b44f20037..a7a9b16b08013 100644 --- a/src/test/ui/regions/regions-close-object-into-object-4.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr @@ -1,10 +1,10 @@ error[E0759]: `v` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement - --> $DIR/regions-close-object-into-object-4.rs:10:11 + --> $DIR/regions-close-object-into-object-4.rs:9:16 | LL | fn i<'a, T, U>(v: Box+'a>) -> Box { | ---------------- this data with lifetime `'a`... -LL | box B(&*v) as Box - | ^^^ ...is captured here, requiring it to live as long as `'static` +LL | Box::new(B(&*v)) as Box + | ^^^ ...is captured here, requiring it to live as long as `'static` | help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v` | diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr index 08ba1b17b5663..7486e73e66ab3 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr @@ -1,29 +1,45 @@ error[E0310]: the parameter type `T` may not live long enough --> $DIR/regions-close-object-into-object-5.rs:17:5 | -LL | box B(&*v) as Box - | ^^^^^^^^^^ +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-object-into-object-5.rs:17:5 + | +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^ + | + = help: consider adding an explicit lifetime bound `T: 'static`... + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-object-into-object-5.rs:17:5 + | +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'static`... error[E0515]: cannot return value referencing local data `*v` --> $DIR/regions-close-object-into-object-5.rs:17:5 | -LL | box B(&*v) as Box - | ^^^^^^---^^^^^^^^^^^ - | | | - | | `*v` is borrowed here +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^---^^^^^^^^^^^^^^^^ + | | | + | | `*v` is borrowed here | returns a value referencing data owned by the current function error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:9 + --> $DIR/regions-close-object-into-object-5.rs:17:14 | -LL | box B(&*v) as Box - | ^^^^^^ +LL | Box::new(B(&*v)) as Box + | ^^^^^^ | = help: consider adding an explicit lifetime bound `T: 'static`... -error: aborting due to 3 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0310, E0515. For more information about an error, try `rustc --explain E0310`. diff --git a/src/test/ui/regions/regions-close-object-into-object-5.rs b/src/test/ui/regions/regions-close-object-into-object-5.rs index ff35b9ada45cd..5471c375b4990 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.rs +++ b/src/test/ui/regions/regions-close-object-into-object-5.rs @@ -1,6 +1,6 @@ -#![feature(box_syntax)] #![allow(warnings)] + trait A { fn get(&self) -> T { panic!() } @@ -14,13 +14,14 @@ impl<'a, T> X for B<'a, T> {} fn f<'a, T, U>(v: Box + 'static>) -> Box { // oh dear! - box B(&*v) as Box + Box::new(B(&*v)) as Box //~^ ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough //~| ERROR the parameter type `T` may not live long enough + //~| ERROR the parameter type `T` may not live long enough } fn main() {} diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.stderr index 5b692cdcc0ecc..83f8d20b9e1de 100644 --- a/src/test/ui/regions/regions-close-object-into-object-5.stderr +++ b/src/test/ui/regions/regions-close-object-into-object-5.stderr @@ -4,26 +4,41 @@ error[E0310]: the parameter type `T` may not live long enough LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! -LL | box B(&*v) as Box - | ^^^^^^^^^^ ...so that the type `B<'_, T>` will meet its required lifetime bounds +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds... + | +note: ...that is required by this bound + --> $DIR/regions-close-object-into-object-5.rs:9:17 + | +LL | struct B<'a, T: 'a>(&'a (A + 'a)); + | ^^ + +error[E0310]: the parameter type `T` may not live long enough + --> $DIR/regions-close-object-into-object-5.rs:17:5 + | +LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { + | - help: consider adding an explicit lifetime bound...: `T: 'static` +LL | // oh dear! +LL | Box::new(B(&*v)) as Box + | ^^^^^^^^^^^^^^^^ ...so that the type `B<'_, T>` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:9 + --> $DIR/regions-close-object-into-object-5.rs:17:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! -LL | box B(&*v) as Box - | ^ ...so that the type `T` will meet its required lifetime bounds +LL | Box::new(B(&*v)) as Box + | ^ ...so that the type `T` will meet its required lifetime bounds error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:9 + --> $DIR/regions-close-object-into-object-5.rs:17:14 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! -LL | box B(&*v) as Box - | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds... +LL | Box::new(B(&*v)) as Box + | ^^^^^^ ...so that the type `T` will meet its required lifetime bounds... | note: ...that is required by this bound --> $DIR/regions-close-object-into-object-5.rs:9:17 @@ -32,32 +47,32 @@ LL | struct B<'a, T: 'a>(&'a (A + 'a)); | ^^ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:11 + --> $DIR/regions-close-object-into-object-5.rs:17:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! -LL | box B(&*v) as Box - | ^^^ ...so that the reference type `&dyn A` does not outlive the data it points at +LL | Box::new(B(&*v)) as Box + | ^^^ ...so that the reference type `&dyn A` does not outlive the data it points at error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:11 + --> $DIR/regions-close-object-into-object-5.rs:17:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! -LL | box B(&*v) as Box - | ^^^ ...so that the type `(dyn A + 'static)` is not borrowed for too long +LL | Box::new(B(&*v)) as Box + | ^^^ ...so that the type `(dyn A + 'static)` is not borrowed for too long error[E0310]: the parameter type `T` may not live long enough - --> $DIR/regions-close-object-into-object-5.rs:17:11 + --> $DIR/regions-close-object-into-object-5.rs:17:16 | LL | fn f<'a, T, U>(v: Box + 'static>) -> Box { | - help: consider adding an explicit lifetime bound...: `T: 'static` LL | // oh dear! -LL | box B(&*v) as Box - | ^^^ ...so that the type `(dyn A + 'static)` is not borrowed for too long +LL | Box::new(B(&*v)) as Box + | ^^^ ...so that the type `(dyn A + 'static)` is not borrowed for too long -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0310`. diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr index 3101d815881b1..b576ae8701137 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr @@ -1,16 +1,16 @@ error[E0310]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:12:5 | -LL | box v as Box - | ^^^^^ +LL | Box::new(v) as Box + | ^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `A: 'static`... error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:21:5 | -LL | box v as Box - | ^^^^^ +LL | Box::new(v) as Box + | ^^^^^^^^^^^ | = help: consider adding an explicit lifetime bound `A: 'b`... diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs index 6e708a5f70fbd..52d18c5d7a6fa 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.rs @@ -1,24 +1,24 @@ -#![feature(box_syntax)] - // Test for what happens when a type parameter `A` is closed over into // an object. This should yield errors unless `A` (and the object) // both have suitable bounds. + trait SomeTrait { fn get(&self) -> isize; } + fn make_object1(v: A) -> Box { - box v as Box + Box::new(v) as Box //~^ ERROR the parameter type `A` may not live long enough } fn make_object2<'a, A: SomeTrait + 'a>(v: A) -> Box { - box v as Box + Box::new(v) as Box } fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box { - box v as Box + Box::new(v) as Box //~^ ERROR the parameter type `A` may not live long enough } diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr index 50274b066df60..063c3b19a19cc 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr @@ -3,16 +3,16 @@ error[E0310]: the parameter type `A` may not live long enough | LL | fn make_object1(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'static +` -LL | box v as Box - | ^^^^^ ...so that the type `A` will meet its required lifetime bounds +LL | Box::new(v) as Box + | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error[E0309]: the parameter type `A` may not live long enough --> $DIR/regions-close-over-type-parameter-1.rs:21:5 | LL | fn make_object3<'a, 'b, A: SomeTrait + 'a>(v: A) -> Box { | -- help: consider adding an explicit lifetime bound...: `A: 'b +` -LL | box v as Box - | ^^^^^ ...so that the type `A` will meet its required lifetime bounds +LL | Box::new(v) as Box + | ^^^^^^^^^^^ ...so that the type `A` will meet its required lifetime bounds error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr index 2fb9dcc4e9ec7..c2bd3bbf823d2 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr @@ -6,8 +6,8 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` +LL | Box::new(v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'c` | = help: consider adding the following bound: `'a: 'c` diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs index 26643e08985be..fc7696e7e0320 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs @@ -1,23 +1,23 @@ -#![feature(box_syntax)] - // Various tests where we over type parameters with multiple lifetime // bounds. + trait SomeTrait { fn get(&self) -> isize; } + fn make_object_good1<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b... - box v as Box // ...hence this type is safe. + Box::new(v) as Box // ...hence this type is safe. } fn make_object_good2<'a,'b,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b... - box v as Box // ...hence this type is safe. + Box::new(v) as Box // ...hence this type is safe. } fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box { // A outlives 'a AND 'b...but not 'c. - box v as Box //~ ERROR cannot infer an appropriate lifetime + Box::new(v) as Box //~ ERROR cannot infer an appropriate lifetime } fn main() { diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr index bf29c76a0f0a8..0cb0b24f108b0 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr +++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr @@ -1,8 +1,8 @@ error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Box::new(v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 18:20... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:20 @@ -12,8 +12,8 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Box::new(v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the lifetime `'c` as defined on the function body at 18:26... --> $DIR/regions-close-over-type-parameter-multiple.rs:18:26 | @@ -22,8 +22,8 @@ LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box $DIR/regions-close-over-type-parameter-multiple.rs:20:5 | -LL | box v as Box - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | Box::new(v) as Box + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: expected `Box<(dyn SomeTrait + 'c)>` found `Box` diff --git a/src/test/ui/regions/regions-close-over-type-parameter-successfully.rs b/src/test/ui/regions/regions-close-over-type-parameter-successfully.rs index 4b47ed8c6aeb7..48aad9481bbea 100644 --- a/src/test/ui/regions/regions-close-over-type-parameter-successfully.rs +++ b/src/test/ui/regions/regions-close-over-type-parameter-successfully.rs @@ -2,8 +2,6 @@ // 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 { @@ -13,7 +11,7 @@ impl<'a> SomeTrait for &'a isize { } fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box { - box v as Box + Box::new(v) as Box } fn main() { diff --git a/src/test/ui/regions/regions-dependent-addr-of.rs b/src/test/ui/regions/regions-dependent-addr-of.rs index 0a7e6625c7353..a6cb56e3156d4 100644 --- a/src/test/ui/regions/regions-dependent-addr-of.rs +++ b/src/test/ui/regions/regions-dependent-addr-of.rs @@ -3,7 +3,6 @@ // Issue #3148. #![feature(box_patterns)] -#![feature(box_syntax)] struct A { value: B @@ -81,7 +80,7 @@ pub fn main() { v2: [23, 24, 25], v3: vec![26, 27, 28], v4: C { f: 29 }, - v5: box C { f: 30 }, + v5: Box::new(C { f: 30 }), v6: Some(C { f: 31 })}}; let p = get_v1(&a); diff --git a/src/test/ui/regions/regions-early-bound-trait-param.rs b/src/test/ui/regions/regions-early-bound-trait-param.rs index 276a64b8e9a7b..a28bd14ba88f6 100644 --- a/src/test/ui/regions/regions-early-bound-trait-param.rs +++ b/src/test/ui/regions/regions-early-bound-trait-param.rs @@ -2,8 +2,6 @@ // 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; @@ -72,7 +70,7 @@ impl<'s> Trait<'s> for (isize,isize) { impl<'t> MakerTrait for Box+'static> { fn mk() -> Box+'static> { - let tup: Box<(isize, isize)> = box (4,5); + let tup: Box<(isize, isize)> = Box::new((4,5)); tup as Box } } diff --git a/src/test/ui/regions/regions-escape-into-other-fn.rs b/src/test/ui/regions/regions-escape-into-other-fn.rs index fd4690463e666..65f4c1b6a6487 100644 --- a/src/test/ui/regions/regions-escape-into-other-fn.rs +++ b/src/test/ui/regions/regions-escape-into-other-fn.rs @@ -1,10 +1,8 @@ // 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; + let p: Box<_> = Box::new(3); assert_eq!(bar(foo(&*p)), 3); } diff --git a/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs index f0ecc5de54567..dca26742dacc5 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs @@ -1,10 +1,9 @@ // run-pass -#![feature(box_syntax)] fn borrow(x: &T) -> &T {x} pub fn main() { - let x: Box<_> = box 3; + let x: Box<_> = Box::new(3); loop { let y = borrow(&*x); assert_eq!(*x, *y); diff --git a/src/test/ui/regions/regions-infer-borrow-scope.rs b/src/test/ui/regions/regions-infer-borrow-scope.rs index 453973d9c58c3..b4a050bf1ede0 100644 --- a/src/test/ui/regions/regions-infer-borrow-scope.rs +++ b/src/test/ui/regions/regions-infer-borrow-scope.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] struct Point {x: isize, y: isize} @@ -9,7 +8,7 @@ fn x_coord(p: &Point) -> &isize { } pub fn main() { - let p: Box<_> = box Point {x: 3, y: 4}; + let p: Box<_> = Box::new(Point {x: 3, y: 4}); let xc = x_coord(&*p); assert_eq!(*xc, 3); } diff --git a/src/test/ui/regions/regions-lifetime-nonfree-late-bound.rs b/src/test/ui/regions/regions-lifetime-nonfree-late-bound.rs index c8106f32c65c2..3852a14d9f98e 100644 --- a/src/test/ui/regions/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/ui/regions/regions-lifetime-nonfree-late-bound.rs @@ -15,19 +15,17 @@ // 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)>| {})); + test(Some(Box::new(|_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) {} - test(Some(box |_f: Box| {})); + test(Some(Box::new(|_f: Box| {}))); } explicit(); diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.rs b/src/test/ui/regions/regions-ref-in-fn-arg.rs index d1cbd279b65a5..3df529c9f0dae 100644 --- a/src/test/ui/regions/regions-ref-in-fn-arg.rs +++ b/src/test/ui/regions/regions-ref-in-fn-arg.rs @@ -1,11 +1,11 @@ #![feature(box_patterns)] -#![feature(box_syntax)] + fn arg_item(box ref x: Box) -> &'static isize { x //~ ERROR cannot return value referencing function parameter } -fn with(f: F) -> R where F: FnOnce(Box) -> R { f(box 3) } +fn with(f: F) -> R where F: FnOnce(Box) -> R { f(Box::new(3)) } fn arg_closure() -> &'static isize { with(|box ref x| x) //~ ERROR cannot return value referencing function parameter diff --git a/src/test/ui/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/ui/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs index aec05161c1afb..b1bdb813ac6aa 100644 --- a/src/test/ui/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/ui/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -9,8 +9,6 @@ // 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 } diff --git a/src/test/ui/regions/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs index 9169d457d4051..94ffb85c9c9c5 100644 --- a/src/test/ui/regions/regions-trait-variance.rs +++ b/src/test/ui/regions/regions-trait-variance.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - // Issue #12470. trait X { @@ -31,9 +29,11 @@ fn make_a(p: &dyn X) -> A { } fn make_make_a<'a>() -> A<'a> { - let b: Box = box B { + + let b: Box = Box::new(B { i: 1, - }; + }); + let bb: &B = &*b; make_a(bb) //~ ERROR cannot return value referencing local data `*b` } diff --git a/src/test/ui/rfcs/rfc-2005-default-binding-mode/box.rs b/src/test/ui/rfcs/rfc-2005-default-binding-mode/box.rs index b3be41599a545..0d1cded36b62d 100644 --- a/src/test/ui/rfcs/rfc-2005-default-binding-mode/box.rs +++ b/src/test/ui/rfcs/rfc-2005-default-binding-mode/box.rs @@ -1,11 +1,11 @@ // run-pass #![allow(unreachable_patterns)] -#![feature(box_syntax, box_patterns)] +#![feature(box_patterns)] struct Foo{} pub fn main() { - let b = box Foo{}; + let b = Box::new(Foo{}); let box f = &b; let _: &Foo = f; diff --git a/src/test/ui/self/explicit-self-generic.rs b/src/test/ui/self/explicit-self-generic.rs index 03f72a5513c20..8f6bed3b0cd6e 100644 --- a/src/test/ui/self/explicit-self-generic.rs +++ b/src/test/ui/self/explicit-self-generic.rs @@ -1,6 +1,5 @@ // run-pass #![allow(dead_code)] -#![feature(box_syntax)] #[derive(Copy, Clone)] struct LM { resize_at: usize, size: usize } @@ -24,6 +23,6 @@ impl HashMap { } pub fn main() { - let mut m: Box<_> = box linear_map::<(),()>(); + let mut m: Box<_> = Box::new(linear_map::<(),()>()); assert_eq!(m.len(), 0); } diff --git a/src/test/ui/self/explicit-self-objects-uniq.rs b/src/test/ui/self/explicit-self-objects-uniq.rs index 0050bc7124d71..250ea12e57c81 100644 --- a/src/test/ui/self/explicit-self-objects-uniq.rs +++ b/src/test/ui/self/explicit-self-objects-uniq.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] trait Foo { fn f(self: Box); @@ -16,7 +15,7 @@ impl Foo for S { } pub fn main() { - let x = box S { x: 3 }; + let x = Box::new(S { x: 3 }); let y = x as Box; y.f(); } diff --git a/src/test/ui/self/explicit-self.rs b/src/test/ui/self/explicit-self.rs index 6d19d33b6fee9..873c3621a3bce 100644 --- a/src/test/ui/self/explicit-self.rs +++ b/src/test/ui/self/explicit-self.rs @@ -3,8 +3,6 @@ #![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} @@ -64,7 +62,7 @@ trait Nus { fn f(&self); } impl Nus for thing { fn f(&self) {} } pub fn main() { - let y: Box<_> = box thing(A {a: 10}); + let y: Box<_> = Box::new(thing(A {a: 10})); assert_eq!(y.clone().bar(), 10); assert_eq!(y.quux(), 10); diff --git a/src/test/ui/self/self-impl-2.rs b/src/test/ui/self/self-impl-2.rs index 23d513e3fac07..7eed3f056a25f 100644 --- a/src/test/ui/self/self-impl-2.rs +++ b/src/test/ui/self/self-impl-2.rs @@ -5,8 +5,6 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - struct Foo; // Test uses on inherent impl. @@ -57,14 +55,14 @@ impl Bar for Box> { let _: Self::SuperQux = true; let _: ::SuperQux = true; - box Baz { f: 42 } + Box::new(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 }, + let _: Foo = Foo::foo(Foo, &Foo, Box::new(Foo)); + let _: Box> = Bar::bar(Box::new(Baz { f: 42 }), + &Box::new(Baz { f: 42 }), + Box::new(Box::new(Baz { f: 42 })), true); } diff --git a/src/test/ui/self/self-in-mut-slot-default-method.rs b/src/test/ui/self/self-in-mut-slot-default-method.rs index 82c5f58f0208f..45e122c8d77a0 100644 --- a/src/test/ui/self/self-in-mut-slot-default-method.rs +++ b/src/test/ui/self/self-in-mut-slot-default-method.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] struct X { a: isize @@ -30,7 +29,7 @@ pub fn main() { let new_x = x.change(); assert_eq!(new_x.a, 55); - let x: Box<_> = box new_x; + let x: Box<_> = Box::new(new_x); let new_x = x.change_again(); assert_eq!(new_x.a, 45); } diff --git a/src/test/ui/self/self-re-assign.rs b/src/test/ui/self/self-re-assign.rs index 88e8614683227..9595ebf9601fb 100644 --- a/src/test/ui/self/self-re-assign.rs +++ b/src/test/ui/self/self-re-assign.rs @@ -2,13 +2,12 @@ // 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)] #![allow(dead_code)] use std::rc::Rc; pub fn main() { - let mut x: Box<_> = box 3; + let mut x: Box<_> = Box::new(3); x = x; assert_eq!(*x, 3); diff --git a/src/test/ui/self/ufcs-explicit-self.rs b/src/test/ui/self/ufcs-explicit-self.rs index 0aaaa7d47c3c1..d83af14d354fb 100644 --- a/src/test/ui/self/ufcs-explicit-self.rs +++ b/src/test/ui/self/ufcs-explicit-self.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] #![allow(dead_code)] #[derive(Copy, Clone)] @@ -37,13 +36,13 @@ impl Bar { } fn main() { - let foo: Box<_> = box Foo { + let foo: Box<_> = Box::new(Foo { f: 1, - }; + }); println!("{} {} {}", foo.foo(2), foo.bar(2), foo.baz(2)); - let bar: Box<_> = box Bar { + let bar: Box<_> = Box::new(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/self/uniq-self-in-mut-slot.rs b/src/test/ui/self/uniq-self-in-mut-slot.rs index 695f06ecddafb..71e57d8c1fa1b 100644 --- a/src/test/ui/self/uniq-self-in-mut-slot.rs +++ b/src/test/ui/self/uniq-self-in-mut-slot.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] struct X { a: isize @@ -17,7 +16,7 @@ impl Changer for X { } pub fn main() { - let x: Box<_> = box X { a: 32 }; + let x: Box<_> = Box::new(X { a: 32 }); let new_x = x.change(); assert_eq!(new_x.a, 55); } diff --git a/src/test/ui/shadowed/shadowed-type-parameter.rs b/src/test/ui/shadowed/shadowed-type-parameter.rs index e74620f8900c0..66fd68a9f2362 100644 --- a/src/test/ui/shadowed/shadowed-type-parameter.rs +++ b/src/test/ui/shadowed/shadowed-type-parameter.rs @@ -1,9 +1,9 @@ // Test that shadowed lifetimes generate an error. -#![feature(box_syntax)] struct Foo(T); + impl Foo { fn shadow_in_method(&self) {} //~^ ERROR the name `T` is already used diff --git a/src/test/ui/span/coerce-suggestions.rs b/src/test/ui/span/coerce-suggestions.rs index c461f825d99a4..7920ae0b26cca 100644 --- a/src/test/ui/span/coerce-suggestions.rs +++ b/src/test/ui/span/coerce-suggestions.rs @@ -1,8 +1,8 @@ -#![feature(box_syntax)] - fn test(_x: &mut String) {} + fn test2(_x: &mut i32) {} + fn main() { let x: usize = String::new(); //~^ ERROR E0308 @@ -14,7 +14,7 @@ fn main() { test2(&y); //~^ ERROR E0308 let f; - f = box f; + f = Box::new(f); //~^ ERROR E0308 let s = &mut String::new(); diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 2487684c1dd7f..74caae8645c1d 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -37,13 +37,10 @@ LL | test2(&y); error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:17:9 | -LL | f = box f; - | ^^^^^ cyclic type of infinite size - | -help: try using a conversion method - | -LL | f = (box f).to_string(); - | + +++++++++++++ +LL | f = Box::new(f); + | ^^^^^^^^^^^- help: try using a conversion method: `.to_string()` + | | + | cyclic type of infinite size error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:21:9 diff --git a/src/test/ui/span/issue-11925.rs b/src/test/ui/span/issue-11925.rs index 0f6472b05f7aa..d9c08fbdd0f15 100644 --- a/src/test/ui/span/issue-11925.rs +++ b/src/test/ui/span/issue-11925.rs @@ -1,10 +1,10 @@ -#![feature(box_syntax, unboxed_closures)] +#![feature(unboxed_closures)] fn to_fn_once>(f: F) -> F { f } fn main() { let r = { - let x: Box<_> = box 42; + let x: Box<_> = Box::new(42); let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x` f() }; diff --git a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs index e34f84683bbc7..16b4cc2586273 100644 --- a/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs +++ b/src/test/ui/span/regions-close-over-borrowed-ref-in-obj.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - fn id(x: T) -> T { x } trait Foo { } @@ -7,10 +5,12 @@ trait Foo { } impl<'a> Foo for &'a isize { } fn main() { + let blah; + { let ss: &isize = &id(1); //~^ ERROR temporary value dropped while borrowed - blah = box ss as Box; + blah = Box::new(ss) as Box; } } diff --git a/src/test/ui/span/regions-close-over-type-parameter-2.rs b/src/test/ui/span/regions-close-over-type-parameter-2.rs index 29083154b8991..aca3972cb6c55 100644 --- a/src/test/ui/span/regions-close-over-type-parameter-2.rs +++ b/src/test/ui/span/regions-close-over-type-parameter-2.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - // Test for what happens when a type parameter `A` is closed over into // an object. This should yield errors unless `A` (and the object) // both have suitable bounds. @@ -7,14 +5,16 @@ trait Foo { fn get(&self); } impl Foo for A { - fn get(&self) { } + fn get(&self) { + } } fn repeater3<'a,A:'a>(v: A) -> Box { - box v as Box + Box::new(v) as Box } fn main() { + // Error results because the type of is inferred to be // ~Repeat<&'blk isize> where blk is the lifetime of the block below. diff --git a/src/test/ui/static/static-region-bound.rs b/src/test/ui/static/static-region-bound.rs index f133133b33650..d70706e5764f6 100644 --- a/src/test/ui/static/static-region-bound.rs +++ b/src/test/ui/static/static-region-bound.rs @@ -1,12 +1,12 @@ -#![feature(box_syntax)] - fn id(x: T) -> T { x } fn f(_: T) {} fn main() { - let x: Box<_> = box 3; + + let x: Box<_> = Box::new(3); f(x); + let x = &id(3); //~ ERROR temporary value dropped while borrowed f(x); } diff --git a/src/test/ui/structs-enums/class-cast-to-trait-cross-crate-2.rs b/src/test/ui/structs-enums/class-cast-to-trait-cross-crate-2.rs index bf1ba8a643fea..f870096fdd44a 100644 --- a/src/test/ui/structs-enums/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/ui/structs-enums/class-cast-to-trait-cross-crate-2.rs @@ -1,8 +1,6 @@ // run-pass // aux-build:cci_class_cast.rs -#![feature(box_syntax)] - extern crate cci_class_cast; use std::string::ToString; @@ -15,6 +13,6 @@ fn print_out(thing: Box, expected: String) { } pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = Box::new(cat(0, 2, "nyan".to_string())) as Box; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/ui/structs-enums/class-separate-impl.rs b/src/test/ui/structs-enums/class-separate-impl.rs index 947690b51f422..3d6da1cc28024 100644 --- a/src/test/ui/structs-enums/class-separate-impl.rs +++ b/src/test/ui/structs-enums/class-separate-impl.rs @@ -2,8 +2,6 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(box_syntax)] - use std::fmt; struct cat { @@ -60,6 +58,6 @@ fn print_out(thing: Box, expected: String) { } pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + let nyan: Box = Box::new(cat(0, 2, "nyan".to_string())) as Box; print_out(nyan, "nyan".to_string()); } diff --git a/src/test/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs b/src/test/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs index 77419e1132dc9..53892a4e0aeb4 100644 --- a/src/test/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] /*! * This is a regression test for a bug in LLVM, fixed in upstream r179587, @@ -9,7 +8,7 @@ enum List { Nil, Cons(X, Box>) } pub fn main() { - match List::Cons(10, box List::Nil) { + match List::Cons(10, Box::new(List::Nil)) { List::Cons(10, _) => {} List::Nil => {} _ => panic!() diff --git a/src/test/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs b/src/test/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs index 8c40b2a5f11d6..1e598b9e70971 100644 --- a/src/test/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs +++ b/src/test/ui/threads-sendsync/sendfn-spawn-with-fn-arg.rs @@ -1,8 +1,6 @@ // run-pass // ignore-emscripten no threads support -#![feature(box_syntax)] - use std::thread; pub fn main() { test05(); } @@ -12,7 +10,7 @@ fn test05_start(f: F) { } fn test05() { - let three: Box<_> = box 3; + let three: Box<_> = Box::new(3); let fn_to_send = move|n:isize| { println!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); diff --git a/src/test/ui/threads-sendsync/task-spawn-move-and-copy.rs b/src/test/ui/threads-sendsync/task-spawn-move-and-copy.rs index 458f5653885e9..a63903778026a 100644 --- a/src/test/ui/threads-sendsync/task-spawn-move-and-copy.rs +++ b/src/test/ui/threads-sendsync/task-spawn-move-and-copy.rs @@ -2,15 +2,13 @@ #![allow(unused_must_use)] // 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: Box = Box::new(1); let x_in_parent = &(*x) as *const isize as usize; let t = thread::spawn(move || { diff --git a/src/test/ui/traits/bound/in-arc.rs b/src/test/ui/traits/bound/in-arc.rs index 941f66c056104..a1492c0b98237 100644 --- a/src/test/ui/traits/bound/in-arc.rs +++ b/src/test/ui/traits/bound/in-arc.rs @@ -5,8 +5,6 @@ // ignore-emscripten no threads support -#![feature(box_syntax)] - use std::sync::Arc; use std::sync::mpsc::channel; use std::thread; @@ -67,10 +65,11 @@ pub fn main() { 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 arc = Arc::new(vec![ + Box::new(catte) as Box, + Box::new(dogge1) as Box, + Box::new(fishe) as Box, + Box::new(dogge2) as Box]); let (tx1, rx1) = channel(); let arc1 = arc.clone(); let t1 = thread::spawn(move|| { check_legs(arc1); tx1.send(()); }); diff --git a/src/test/ui/traits/coercion.rs b/src/test/ui/traits/coercion.rs index cba33af1f1aca..e62742bac5c74 100644 --- a/src/test/ui/traits/coercion.rs +++ b/src/test/ui/traits/coercion.rs @@ -2,7 +2,6 @@ #![allow(dead_code)] #![allow(unused_mut)] #![allow(unused_variables)] -#![feature(box_syntax)] use std::io::{self, Write}; diff --git a/src/test/ui/traits/conditional-dispatch.rs b/src/test/ui/traits/conditional-dispatch.rs index a9c194486fecb..dd882dce66635 100644 --- a/src/test/ui/traits/conditional-dispatch.rs +++ b/src/test/ui/traits/conditional-dispatch.rs @@ -3,7 +3,6 @@ // 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; @@ -20,7 +19,7 @@ impl Get for T { } impl Get for Box { - fn get(&self) -> Box { box get_it(&**self) } + fn get(&self) -> Box { Box::new(get_it(&**self)) } } fn get_it(t: &T) -> T { diff --git a/src/test/ui/traits/issue-6128.rs b/src/test/ui/traits/issue-6128.rs index 8859fbe6afb7b..07d92f8f8a016 100644 --- a/src/test/ui/traits/issue-6128.rs +++ b/src/test/ui/traits/issue-6128.rs @@ -1,7 +1,5 @@ // run-pass -#![feature(box_syntax)] - use std::collections::HashMap; trait Graph { @@ -19,6 +17,6 @@ impl Graph for HashMap { } pub fn main() { - let g : Box> = box HashMap::new(); + let g : Box> = Box::new(HashMap::new()); let _g2 : Box> = g as Box>; } diff --git a/src/test/ui/traits/kindck-owned-contains-1.rs b/src/test/ui/traits/kindck-owned-contains-1.rs index 23b91f924b553..8adb06ba3d04e 100644 --- a/src/test/ui/traits/kindck-owned-contains-1.rs +++ b/src/test/ui/traits/kindck-owned-contains-1.rs @@ -2,8 +2,6 @@ #![allow(non_snake_case)] #![allow(non_camel_case_types)] -#![feature(box_syntax)] - trait repeat { fn get(&self) -> A; } impl repeat for Box { @@ -13,11 +11,11 @@ impl repeat for Box { } fn repeater(v: Box) -> Box+'static> { - box v as Box+'static> // No + Box::new(v) as Box+'static> // No } pub fn main() { let x = 3; - let y = repeater(box x); + let y = repeater(Box::new(x)); assert_eq!(x, y.get()); } diff --git a/src/test/ui/traits/object-one-type-two-traits.rs b/src/test/ui/traits/object-one-type-two-traits.rs index b92a2ab7b4bc2..86a2094eee098 100644 --- a/src/test/ui/traits/object-one-type-two-traits.rs +++ b/src/test/ui/traits/object-one-type-two-traits.rs @@ -4,8 +4,6 @@ // Testing creating two vtables with the same self type, but different // traits. -#![feature(box_syntax)] - use std::any::Any; trait Wrap { @@ -27,7 +25,7 @@ fn is(x: &dyn Any) -> bool { } fn main() { - let x = box 22isize as Box; + let x = Box::new(22isize) as Box; println!("x={}", x.get()); let y = x.wrap(); } diff --git a/src/test/ui/traits/object/generics.rs b/src/test/ui/traits/object/generics.rs index c18754302b75b..e5a96af3810de 100644 --- a/src/test/ui/traits/object/generics.rs +++ b/src/test/ui/traits/object/generics.rs @@ -1,8 +1,6 @@ // run-pass // test for #8664 -#![feature(box_syntax)] - use std::marker; pub trait Trait2 { @@ -38,6 +36,6 @@ impl Trait for () { } pub fn main() { - let a = box () as Box>; + let a = Box::new(()) as Box>; assert_eq!(a.method(Type::Constant((1, 2))), 0); } diff --git a/src/test/ui/traits/test-2.rs b/src/test/ui/traits/test-2.rs index 183c779607c95..342928e882a55 100644 --- a/src/test/ui/traits/test-2.rs +++ b/src/test/ui/traits/test-2.rs @@ -1,6 +1,6 @@ -#![feature(box_syntax)] - #[allow(non_camel_case_types)] + + trait bar { fn dup(&self) -> Self; fn blah(&self); } impl bar for i32 { fn dup(&self) -> i32 { *self } fn blah(&self) {} } impl bar for u32 { fn dup(&self) -> u32 { *self } fn blah(&self) {} } @@ -10,7 +10,8 @@ fn main() { //~^ ERROR this associated function takes 0 generic arguments but 1 10.blah::(); //~^ ERROR this associated function takes 1 generic argument but 2 - (box 10 as Box).dup(); + (Box::new(10) as Box).dup(); //~^ ERROR E0038 //~| ERROR E0038 + //~| ERROR E0038 } diff --git a/src/test/ui/traits/test-2.stderr b/src/test/ui/traits/test-2.stderr index d943b48fd0082..77ea4e4e974eb 100644 --- a/src/test/ui/traits/test-2.stderr +++ b/src/test/ui/traits/test-2.stderr @@ -27,10 +27,27 @@ LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } | ^^^^ - error[E0038]: the trait `bar` cannot be made into an object - --> $DIR/test-2.rs:13:16 + --> $DIR/test-2.rs:13:22 | -LL | (box 10 as Box).dup(); - | ^^^^^^^^^^^^ `bar` cannot be made into an object +LL | (Box::new(10) as Box).dup(); + | ^^^^^^^^^^^^ `bar` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/test-2.rs:4:30 + | +LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } + | --- ^^^^ ^^^^ ...because method `blah` has generic type parameters + | | | + | | ...because method `dup` references the `Self` type in its return type + | this trait cannot be made into an object... + = help: consider moving `dup` to another trait + = help: consider moving `blah` to another trait + +error[E0038]: the trait `bar` cannot be made into an object + --> $DIR/test-2.rs:13:5 + | +LL | (Box::new(10) as Box).dup(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/test-2.rs:4:30 @@ -46,8 +63,8 @@ LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } error[E0038]: the trait `bar` cannot be made into an object --> $DIR/test-2.rs:13:6 | -LL | (box 10 as Box).dup(); - | ^^^^^^ `bar` cannot be made into an object +LL | (Box::new(10) as Box).dup(); + | ^^^^^^^^^^^^ `bar` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit --> $DIR/test-2.rs:4:30 @@ -62,7 +79,7 @@ LL | trait bar { fn dup(&self) -> Self; fn blah(&self); } = note: required because of the requirements on the impl of `CoerceUnsized>` for `Box<{integer}>` = note: required by cast to type `Box` -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors Some errors have detailed explanations: E0038, E0107. For more information about an error, try `rustc --explain E0038`. diff --git a/src/test/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs b/src/test/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs index 277d9eabe4fb2..6d88002540c1a 100644 --- a/src/test/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs +++ b/src/test/ui/traits/trait-upcasting/issue-11515-upcast-fn_mut-fn.rs @@ -1,5 +1,5 @@ // run-pass -#![feature(box_syntax, trait_upcasting)] +#![feature(trait_upcasting)] #![allow(incomplete_features)] struct Test { @@ -8,6 +8,6 @@ struct Test { fn main() { let closure: Box = Box::new(|| ()); - let mut test = box Test { func: closure }; + let mut test = Box::new(Test { func: closure }); (test.func)(); } diff --git a/src/test/ui/type-param-constraints.rs b/src/test/ui/type-param-constraints.rs index 4b42fddaf5c88..3d87a089fca3a 100644 --- a/src/test/ui/type-param-constraints.rs +++ b/src/test/ui/type-param-constraints.rs @@ -4,8 +4,6 @@ #![allow(dead_code)] // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - fn p_foo(_pinned: T) { } fn s_foo(_shared: T) { } fn u_foo(_unique: T) { } @@ -27,13 +25,13 @@ fn r(i:isize) -> r { pub fn main() { p_foo(r(10)); - p_foo::>(box r(10)); - p_foo::>(box 10); + p_foo::>(Box::new(r(10))); + p_foo::>(Box::new(10)); p_foo(10); - s_foo::>(box 10); + s_foo::>(Box::new(10)); s_foo(10); - u_foo::>(box 10); + u_foo::>(Box::new(10)); u_foo(10); } diff --git a/src/test/ui/typeclasses-eq-example-static.rs b/src/test/ui/typeclasses-eq-example-static.rs index 282d51a93df89..f982ad6a0ddc3 100644 --- a/src/test/ui/typeclasses-eq-example-static.rs +++ b/src/test/ui/typeclasses-eq-example-static.rs @@ -3,7 +3,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] -#![feature(box_syntax)] // Example from lkuper's intern talk, August 2012 -- now with static // methods! @@ -59,11 +58,11 @@ pub fn main() { assert!(Equal::isEq(&leaf(cyan), &leaf(cyan))); assert!(!Equal::isEq(&leaf(cyan), &leaf(yellow))); - assert!(Equal::isEq(&branch(box leaf(magenta), box leaf(cyan)), - &branch(box leaf(magenta), box leaf(cyan)))); + assert!(Equal::isEq(&branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))), + &branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))))); - assert!(!Equal::isEq(&branch(box leaf(magenta), box leaf(cyan)), - &branch(box leaf(magenta), box leaf(magenta)))); + assert!(!Equal::isEq(&branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))), + &branch(Box::new(leaf(magenta)), Box::new(leaf(magenta))))); println!("Assertions all succeeded!"); } diff --git a/src/test/ui/typeclasses-eq-example.rs b/src/test/ui/typeclasses-eq-example.rs index 8d1d22eb82300..4400301e61ed7 100644 --- a/src/test/ui/typeclasses-eq-example.rs +++ b/src/test/ui/typeclasses-eq-example.rs @@ -3,7 +3,6 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] -#![feature(box_syntax)] // Example from lkuper's intern talk, August 2012. use Color::{cyan, magenta, yellow, black}; @@ -55,11 +54,11 @@ pub fn main() { assert!(leaf(cyan).isEq(&leaf(cyan))); assert!(!leaf(cyan).isEq(&leaf(yellow))); - assert!(branch(box leaf(magenta), box leaf(cyan)) - .isEq(&branch(box leaf(magenta), box leaf(cyan)))); + assert!(branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))) + .isEq(&branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))))); - assert!(!branch(box leaf(magenta), box leaf(cyan)) - .isEq(&branch(box leaf(magenta), box leaf(magenta)))); + assert!(!branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))) + .isEq(&branch(Box::new(leaf(magenta)), Box::new(leaf(magenta))))); println!("Assertions all succeeded!"); } diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.rs b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs index e836d33976a93..cb1fac0bae6ae 100644 --- a/src/test/ui/ufcs/ufcs-explicit-self-bad.rs +++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs @@ -1,9 +1,9 @@ -#![feature(box_syntax)] - struct Foo { f: isize, } + + impl Foo { fn foo(self: isize, x: isize) -> isize { //~^ ERROR invalid `self` parameter type @@ -48,12 +48,12 @@ impl<'a, T> SomeTrait for &'a Bar { } fn main() { - let foo = box Foo { + let foo = Box::new(Foo { f: 1, - }; + }); println!("{}", foo.foo(2)); - let bar = box Bar { + let bar = Box::new(Bar { f: 1, - }; + }); println!("{} {}", bar.foo(2), bar.bar(2)); } diff --git a/src/test/ui/unboxed-closures/unboxed-closures-boxed.rs b/src/test/ui/unboxed-closures/unboxed-closures-boxed.rs index b2596e49aa78e..3f550fd04259f 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-boxed.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-boxed.rs @@ -1,10 +1,9 @@ // run-pass -#![feature(box_syntax)] use std::ops::FnMut; fn make_adder(x: i32) -> Boxi32+'static> { - (box move |y: i32| -> i32 { x + y }) as + Box::new(move |y: i32| -> i32 { x + y }) as Boxi32+'static> } diff --git a/src/test/ui/uninhabited/uninhabited-patterns.rs b/src/test/ui/uninhabited/uninhabited-patterns.rs index 58c726d2185c4..f1573b6adf0ce 100644 --- a/src/test/ui/uninhabited/uninhabited-patterns.rs +++ b/src/test/ui/uninhabited/uninhabited-patterns.rs @@ -1,8 +1,8 @@ #![feature(box_patterns)] -#![feature(box_syntax)] #![feature(never_type)] #![feature(exhaustive_patterns)] + #![deny(unreachable_patterns)] mod foo { diff --git a/src/test/ui/unique-object-noncopyable.rs b/src/test/ui/unique-object-noncopyable.rs index d243b8f34dbcf..2c40dfc7a4b25 100644 --- a/src/test/ui/unique-object-noncopyable.rs +++ b/src/test/ui/unique-object-noncopyable.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - trait Foo { fn f(&self); } @@ -18,8 +16,10 @@ impl Foo for Bar { } } + + fn main() { - let x = box Bar { x: 10 }; + let x = Box::new(Bar { x: 10 }); let y: Box = x as Box; let _z = y.clone(); //~ ERROR the method } diff --git a/src/test/ui/unique/unique-assign-copy.rs b/src/test/ui/unique/unique-assign-copy.rs index 194698102377e..b742973ce327d 100644 --- a/src/test/ui/unique/unique-assign-copy.rs +++ b/src/test/ui/unique/unique-assign-copy.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let mut i: Box<_> = box 1; + let mut i: Box<_> = Box::new(1); // Should be a copy let mut j; j = i.clone(); diff --git a/src/test/ui/unique/unique-assign-drop.rs b/src/test/ui/unique/unique-assign-drop.rs index 32068e79df49c..e7685b589ca8e 100644 --- a/src/test/ui/unique/unique-assign-drop.rs +++ b/src/test/ui/unique/unique-assign-drop.rs @@ -1,11 +1,9 @@ // run-pass #![allow(unused_assignments)] -#![feature(box_syntax)] - pub fn main() { - let i: Box<_> = box 1; - let mut j: Box<_> = box 2; + let i: Box<_> = Box::new(1); + let mut j: Box<_> = Box::new(2); // Should drop the previous value of j j = i; assert_eq!(*j, 1); diff --git a/src/test/ui/unique/unique-assign-generic.rs b/src/test/ui/unique/unique-assign-generic.rs index 2d62ce59ad012..d4932d8333ab7 100644 --- a/src/test/ui/unique/unique-assign-generic.rs +++ b/src/test/ui/unique/unique-assign-generic.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] fn f(t: T) -> T { let t1 = t; @@ -7,6 +6,6 @@ fn f(t: T) -> T { } pub fn main() { - let t = f::>(box 100); - assert_eq!(t, box 100); + let t = f::>(Box::new(100)); + assert_eq!(t, Box::new(100)); } diff --git a/src/test/ui/unique/unique-assign.rs b/src/test/ui/unique/unique-assign.rs index 5a88df071a0b9..d598744f145b2 100644 --- a/src/test/ui/unique/unique-assign.rs +++ b/src/test/ui/unique/unique-assign.rs @@ -1,9 +1,8 @@ // run-pass #![allow(unused_mut)] -#![feature(box_syntax)] pub fn main() { let mut i: Box<_>; - i = box 1; + i = Box::new(1); assert_eq!(*i, 1); } diff --git a/src/test/ui/unique/unique-autoderef-field.rs b/src/test/ui/unique/unique-autoderef-field.rs index 0360646f1330e..64147e11f1c0c 100644 --- a/src/test/ui/unique/unique-autoderef-field.rs +++ b/src/test/ui/unique/unique-autoderef-field.rs @@ -1,11 +1,10 @@ // run-pass -#![feature(box_syntax)] struct J { j: isize } pub fn main() { - let i: Box<_> = box J { + let i: Box<_> = Box::new(J { j: 100 - }; + }); assert_eq!(i.j, 100); } diff --git a/src/test/ui/unique/unique-autoderef-index.rs b/src/test/ui/unique/unique-autoderef-index.rs index 5a3d17a84efc2..ea6598a7f6b35 100644 --- a/src/test/ui/unique/unique-autoderef-index.rs +++ b/src/test/ui/unique/unique-autoderef-index.rs @@ -1,7 +1,6 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box vec![100]; + let i: Box<_> = Box::new(vec![100]); assert_eq!((*i)[0], 100); } diff --git a/src/test/ui/unique/unique-cmp.rs b/src/test/ui/unique/unique-cmp.rs index 7bbc61d25ac78..ee05dd5a31d5b 100644 --- a/src/test/ui/unique/unique-cmp.rs +++ b/src/test/ui/unique/unique-cmp.rs @@ -1,12 +1,11 @@ // run-pass #![allow(unused_allocation)] -#![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); + let i: Box<_> = Box::new(100); + assert_eq!(i, Box::new(100)); + assert!(i < Box::new(101)); + assert!(i <= Box::new(100)); + assert!(i > Box::new(99)); + assert!(i >= Box::new(99)); } diff --git a/src/test/ui/unique/unique-containing-tag.rs b/src/test/ui/unique/unique-containing-tag.rs index f24b3a8645f29..6c31ae99b8eef 100644 --- a/src/test/ui/unique/unique-containing-tag.rs +++ b/src/test/ui/unique/unique-containing-tag.rs @@ -4,12 +4,10 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { enum t { t1(isize), t2(isize), } - let _x: Box<_> = box t::t1(10); + let _x: Box<_> = Box::new(t::t1(10)); /*alt *x { t1(a) { @@ -19,9 +17,9 @@ pub fn main() { }*/ /*alt x { - box t1(a) { + Box::new(t1(a) { assert_eq!(a, 10); - } + }) _ { panic!(); } }*/ } diff --git a/src/test/ui/unique/unique-create.rs b/src/test/ui/unique/unique-create.rs index 3df0f7d55fd58..c566e79620a95 100644 --- a/src/test/ui/unique/unique-create.rs +++ b/src/test/ui/unique/unique-create.rs @@ -2,10 +2,8 @@ #![allow(dead_code)] // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { - let _: Box<_> = box 100; + let _: Box<_> = Box::new(100); } fn vec() { diff --git a/src/test/ui/unique/unique-decl-init-copy.rs b/src/test/ui/unique/unique-decl-init-copy.rs index 6ae95949e84da..5b9576fcc7a5b 100644 --- a/src/test/ui/unique/unique-decl-init-copy.rs +++ b/src/test/ui/unique/unique-decl-init-copy.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let mut i: Box<_> = box 1; + let mut i: Box<_> = Box::new(1); // Should be a copy let mut j = i.clone(); *i = 2; diff --git a/src/test/ui/unique/unique-decl-init.rs b/src/test/ui/unique/unique-decl-init.rs index 2c7b9d6054f44..1d70860c7cec0 100644 --- a/src/test/ui/unique/unique-decl-init.rs +++ b/src/test/ui/unique/unique-decl-init.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box 1; + let i: Box<_> = Box::new(1); let j = i; assert_eq!(*j, 1); } diff --git a/src/test/ui/unique/unique-decl-move.rs b/src/test/ui/unique/unique-decl-move.rs index 4a5ee56ea9282..21187510ff0c5 100644 --- a/src/test/ui/unique/unique-decl-move.rs +++ b/src/test/ui/unique/unique-decl-move.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box 100; + let i: Box<_> = Box::new(100); let j = i; assert_eq!(*j, 100); } diff --git a/src/test/ui/unique/unique-deref.rs b/src/test/ui/unique/unique-deref.rs index 0c6af0f7f97af..33a1e9932b5d1 100644 --- a/src/test/ui/unique/unique-deref.rs +++ b/src/test/ui/unique/unique-deref.rs @@ -1,7 +1,6 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box 100; + let i: Box<_> = Box::new(100); assert_eq!(*i, 100); } diff --git a/src/test/ui/unique/unique-destructure.rs b/src/test/ui/unique/unique-destructure.rs index 9b9f95dfbcae6..7207ac962953e 100644 --- a/src/test/ui/unique/unique-destructure.rs +++ b/src/test/ui/unique/unique-destructure.rs @@ -1,10 +1,9 @@ // 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}; + let box Foo{ a, b } = Box::new(Foo { a: 100, b: 200 }); assert_eq!(a + b, 300); } diff --git a/src/test/ui/unique/unique-drop-complex.rs b/src/test/ui/unique/unique-drop-complex.rs index 0b7bda83b3fa1..2324f1e1a652f 100644 --- a/src/test/ui/unique/unique-drop-complex.rs +++ b/src/test/ui/unique/unique-drop-complex.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { - let _x: Box<_> = box vec![0,0,0,0,0]; + let _x: Box<_> = Box::new(vec![0,0,0,0,0]); } diff --git a/src/test/ui/unique/unique-fn-arg-move.rs b/src/test/ui/unique/unique-fn-arg-move.rs index ff33839e57ee2..6d42df218fbfd 100644 --- a/src/test/ui/unique/unique-fn-arg-move.rs +++ b/src/test/ui/unique/unique-fn-arg-move.rs @@ -1,11 +1,10 @@ // run-pass -#![feature(box_syntax)] fn f(i: Box) { assert_eq!(*i, 100); } pub fn main() { - let i = box 100; + let i = Box::new(100); f(i); } diff --git a/src/test/ui/unique/unique-fn-arg-mut.rs b/src/test/ui/unique/unique-fn-arg-mut.rs index e8bb35e4eb0cf..01510200b11b7 100644 --- a/src/test/ui/unique/unique-fn-arg-mut.rs +++ b/src/test/ui/unique/unique-fn-arg-mut.rs @@ -1,12 +1,11 @@ // run-pass -#![feature(box_syntax)] fn f(i: &mut Box) { - *i = box 200; + *i = Box::new(200); } pub fn main() { - let mut i = box 100; + let mut i = Box::new(100); f(&mut i); assert_eq!(*i, 200); } diff --git a/src/test/ui/unique/unique-fn-arg.rs b/src/test/ui/unique/unique-fn-arg.rs index 75f2a767f59ba..b4f3bc4b294ba 100644 --- a/src/test/ui/unique/unique-fn-arg.rs +++ b/src/test/ui/unique/unique-fn-arg.rs @@ -1,12 +1,11 @@ // run-pass -#![feature(box_syntax)] fn f(i: Box) { assert_eq!(*i, 100); } pub fn main() { - f(box 100); - let i = box 100; + f(Box::new(100)); + let i = Box::new(100); f(i); } diff --git a/src/test/ui/unique/unique-fn-ret.rs b/src/test/ui/unique/unique-fn-ret.rs index cd44cfa983661..773a9bce1adb0 100644 --- a/src/test/ui/unique/unique-fn-ret.rs +++ b/src/test/ui/unique/unique-fn-ret.rs @@ -1,10 +1,9 @@ // run-pass -#![feature(box_syntax)] fn f() -> Box { - box 100 + Box::new(100) } pub fn main() { - assert_eq!(f(), box 100); + assert_eq!(f(), Box::new(100)); } diff --git a/src/test/ui/unique/unique-in-tag.rs b/src/test/ui/unique/unique-in-tag.rs index 8d97ebe659097..6daa06fb12de6 100644 --- a/src/test/ui/unique/unique-in-tag.rs +++ b/src/test/ui/unique/unique-in-tag.rs @@ -2,12 +2,10 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -#![feature(box_syntax)] - fn test1() { enum bar { u(Box), w(isize), } - let x = bar::u(box 10); + let x = bar::u(Box::new(10)); assert!(match x { bar::u(a) => { println!("{}", a); diff --git a/src/test/ui/unique/unique-in-vec-copy.rs b/src/test/ui/unique/unique-in-vec-copy.rs index 8907a8b20a7ae..ce52d15ef1acb 100644 --- a/src/test/ui/unique/unique-in-vec-copy.rs +++ b/src/test/ui/unique/unique-in-vec-copy.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let mut a: Vec> = vec![box 10]; + let mut a: Vec> = vec![Box::new(10)]; let b = a.clone(); assert_eq!(*a[0], 10); diff --git a/src/test/ui/unique/unique-in-vec.rs b/src/test/ui/unique/unique-in-vec.rs index 528ea4fb870e8..1e8d05e3d269f 100644 --- a/src/test/ui/unique/unique-in-vec.rs +++ b/src/test/ui/unique/unique-in-vec.rs @@ -1,7 +1,6 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let vect : Vec> = vec![box 100]; - assert_eq!(vect[0], box 100); + let vect : Vec> = vec![Box::new(100)]; + assert_eq!(vect[0], Box::new(100)); } diff --git a/src/test/ui/unique/unique-init.rs b/src/test/ui/unique/unique-init.rs index c8a150522fd2e..d19605046e1bc 100644 --- a/src/test/ui/unique/unique-init.rs +++ b/src/test/ui/unique/unique-init.rs @@ -1,8 +1,6 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { - let _i: Box<_> = box 100; + let _i: Box<_> = Box::new(100); } diff --git a/src/test/ui/unique/unique-kinds.rs b/src/test/ui/unique/unique-kinds.rs index f369a1e2a190d..f02d0b50764ae 100644 --- a/src/test/ui/unique/unique-kinds.rs +++ b/src/test/ui/unique/unique-kinds.rs @@ -1,5 +1,4 @@ // run-pass -#![feature(box_syntax)] use std::cmp::PartialEq; use std::fmt::Debug; @@ -14,11 +13,11 @@ fn sendable() { assert!(i != j); } - let i: Box<_> = box 100; - let j: Box<_> = box 100; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(100); f(i, j); - let i: Box<_> = box 100; - let j: Box<_> = box 101; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(101); g(i, j); } @@ -32,11 +31,11 @@ fn copyable() { assert!(i != j); } - let i: Box<_> = box 100; - let j: Box<_> = box 100; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(100); f(i, j); - let i: Box<_> = box 100; - let j: Box<_> = box 101; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(101); g(i, j); } @@ -50,11 +49,11 @@ fn noncopyable() { assert!(i != j); } - let i: Box<_> = box 100; - let j: Box<_> = box 100; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(100); f(i, j); - let i: Box<_> = box 100; - let j: Box<_> = box 101; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(101); g(i, j); } diff --git a/src/test/ui/unique/unique-log.rs b/src/test/ui/unique/unique-log.rs index 279777177061d..0715d16628f87 100644 --- a/src/test/ui/unique/unique-log.rs +++ b/src/test/ui/unique/unique-log.rs @@ -1,7 +1,6 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box 100; + let i: Box<_> = Box::new(100); println!("{}", i); } diff --git a/src/test/ui/unique/unique-move-drop.rs b/src/test/ui/unique/unique-move-drop.rs index e1ea58b39ef50..c0f5d8f90532d 100644 --- a/src/test/ui/unique/unique-move-drop.rs +++ b/src/test/ui/unique/unique-move-drop.rs @@ -1,11 +1,10 @@ // run-pass #![allow(unused_variables)] -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box 100; - let j: Box<_> = box 200; + let i: Box<_> = Box::new(100); + let j: Box<_> = Box::new(200); let j = i; assert_eq!(*j, 100); } diff --git a/src/test/ui/unique/unique-move-temp.rs b/src/test/ui/unique/unique-move-temp.rs index 4f5de50b722f9..103af8e1f1e02 100644 --- a/src/test/ui/unique/unique-move-temp.rs +++ b/src/test/ui/unique/unique-move-temp.rs @@ -1,9 +1,8 @@ // run-pass #![allow(unused_mut)] -#![feature(box_syntax)] pub fn main() { let mut i: Box<_>; - i = box 100; + i = Box::new(100); assert_eq!(*i, 100); } diff --git a/src/test/ui/unique/unique-move.rs b/src/test/ui/unique/unique-move.rs index 0f6bff1432b3f..40a2718e4e5f6 100644 --- a/src/test/ui/unique/unique-move.rs +++ b/src/test/ui/unique/unique-move.rs @@ -1,9 +1,8 @@ // run-pass #![allow(unused_mut)] -#![feature(box_syntax)] pub fn main() { - let i: Box<_> = box 100; + let i: Box<_> = Box::new(100); let mut j; j = i; assert_eq!(*j, 100); diff --git a/src/test/ui/unique/unique-mutable.rs b/src/test/ui/unique/unique-mutable.rs index 176cf33d4889c..0367c08099a83 100644 --- a/src/test/ui/unique/unique-mutable.rs +++ b/src/test/ui/unique/unique-mutable.rs @@ -1,8 +1,7 @@ // run-pass -#![feature(box_syntax)] pub fn main() { - let mut i: Box<_> = box 0; + let mut i: Box<_> = Box::new(0); *i = 1; assert_eq!(*i, 1); } diff --git a/src/test/ui/unique/unique-object-move.rs b/src/test/ui/unique/unique-object-move.rs index 84e8cdb32b84e..bb35a9b2d73e2 100644 --- a/src/test/ui/unique/unique-object-move.rs +++ b/src/test/ui/unique/unique-object-move.rs @@ -4,8 +4,6 @@ // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub trait EventLoop { fn foo(&self) {} } pub struct UvEventLoop { @@ -15,6 +13,6 @@ pub struct UvEventLoop { impl EventLoop for UvEventLoop { } pub fn main() { - let loop_: Box = box UvEventLoop { uvio: 0 } as Box; + let loop_: Box = Box::new(UvEventLoop { uvio: 0 }) as Box; let _loop2_ = loop_; } diff --git a/src/test/ui/unique/unique-pat-2.rs b/src/test/ui/unique/unique-pat-2.rs index c18e029b252cb..9c73fd2204c38 100644 --- a/src/test/ui/unique/unique-pat-2.rs +++ b/src/test/ui/unique/unique-pat-2.rs @@ -4,15 +4,15 @@ #![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); + let v = match bar::u(Box::new(Foo{ a: 10, b: 40 })) { + bar::u(box Foo{ a: a, b: b }) => { a + (b as isize) } + _ => { 66 } + }; + assert_eq!(v, 50); } diff --git a/src/test/ui/unique/unique-pat-3.rs b/src/test/ui/unique/unique-pat-3.rs index e17b5a3ddb450..2e81f898d0c98 100644 --- a/src/test/ui/unique/unique-pat-3.rs +++ b/src/test/ui/unique/unique-pat-3.rs @@ -2,16 +2,15 @@ #![allow(dead_code)] #![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); + let v = match bar::u(10.into()) { + bar::u(a) => { + println!("{}", a); + *a + } + _ => { 66 } + }; + assert_eq!(v, 10); } diff --git a/src/test/ui/unique/unique-pat.rs b/src/test/ui/unique/unique-pat.rs index b32195ac27421..c2474d0e77214 100644 --- a/src/test/ui/unique/unique-pat.rs +++ b/src/test/ui/unique/unique-pat.rs @@ -1,10 +1,9 @@ // run-pass #![feature(box_patterns)] -#![feature(box_syntax)] fn simple() { - match box true { + match Box::new(true) { box true => { } _ => { panic!(); } } diff --git a/src/test/ui/unique/unique-rec.rs b/src/test/ui/unique/unique-rec.rs index c8bddd246a805..9f8ad9bb05043 100644 --- a/src/test/ui/unique/unique-rec.rs +++ b/src/test/ui/unique/unique-rec.rs @@ -1,10 +1,9 @@ // run-pass -#![feature(box_syntax)] struct X { x: isize } pub fn main() { - let x: Box<_> = box X {x: 1}; + let x: Box<_> = Box::new(X {x: 1}); let bar = x; assert_eq!(bar.x, 1); } diff --git a/src/test/ui/unique/unique-send-2.rs b/src/test/ui/unique/unique-send-2.rs index 22f0e6c3a49b0..23ddd2cdca25d 100644 --- a/src/test/ui/unique/unique-send-2.rs +++ b/src/test/ui/unique/unique-send-2.rs @@ -2,13 +2,11 @@ #![allow(unused_must_use)] // 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(); + tx.send(Box::new(i)).unwrap(); } pub fn main() { diff --git a/src/test/ui/unique/unique-send.rs b/src/test/ui/unique/unique-send.rs index a5c7561b9ae3c..431cc2be5d20e 100644 --- a/src/test/ui/unique/unique-send.rs +++ b/src/test/ui/unique/unique-send.rs @@ -1,11 +1,10 @@ // run-pass -#![feature(box_syntax)] use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel::>(); - tx.send(box 100).unwrap(); + tx.send(Box::new(100)).unwrap(); let v = rx.recv().unwrap(); - assert_eq!(v, box 100); + assert_eq!(v, Box::new(100)); } diff --git a/src/test/ui/unique/unique-swap.rs b/src/test/ui/unique/unique-swap.rs index 33a6b3b3ed046..4f33ff9a8a35e 100644 --- a/src/test/ui/unique/unique-swap.rs +++ b/src/test/ui/unique/unique-swap.rs @@ -1,12 +1,11 @@ // run-pass -#![feature(box_syntax)] use std::mem::swap; pub fn main() { - let mut i: Box<_> = box 100; - let mut j: Box<_> = box 200; + let mut i: Box<_> = Box::new(100); + let mut j: Box<_> = Box::new(200); swap(&mut i, &mut j); - assert_eq!(i, box 200); - assert_eq!(j, box 100); + assert_eq!(i, Box::new(200)); + assert_eq!(j, Box::new(100)); } diff --git a/src/test/ui/unsized/unsized2.rs b/src/test/ui/unsized/unsized2.rs index be4406399fd0f..bbeb00d5fed60 100644 --- a/src/test/ui/unsized/unsized2.rs +++ b/src/test/ui/unsized/unsized2.rs @@ -4,7 +4,6 @@ #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] -#![feature(box_syntax)] // Test sized-ness checking in substitution. @@ -36,7 +35,7 @@ trait T2 { struct S; impl T2 for S { fn f() -> Box { - box S + Box::new(S) } } fn f5(x: &X) { @@ -51,7 +50,7 @@ trait T3 { } impl T3 for S { fn f() -> Box { - box S + Box::new(S) } } fn f7(x: &X) { diff --git a/src/test/ui/unsized/unsized3-rpass.rs b/src/test/ui/unsized/unsized3-rpass.rs index c5c5ed26c7384..4d5e89575bef6 100644 --- a/src/test/ui/unsized/unsized3-rpass.rs +++ b/src/test/ui/unsized/unsized3-rpass.rs @@ -2,7 +2,7 @@ // Test structs with always-unsized fields. #![allow(warnings)] -#![feature(box_syntax, unsize, ptr_metadata)] +#![feature(unsize, ptr_metadata)] use std::mem; use std::ptr; @@ -58,7 +58,7 @@ pub fn main() { f: [T; 3], } - let data: Box> = box Foo_ { f: [1, 2, 3] }; + let data: Box> = Box::new(Foo_ { f: [1, 2, 3] }); let x: &Foo = mem::transmute(slice::from_raw_parts(&*data, 3)); assert_eq!(x.f.len(), 3); assert_eq!(x.f[0], 1); @@ -69,7 +69,7 @@ pub fn main() { } let data: Box<_> = - box Baz_ { f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] }; + Box::new(Baz_ { f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] }); let x: &Baz = mem::transmute(slice::from_raw_parts(&*data, 5)); assert_eq!(x.f1, 42); let chs: Vec = x.f2.chars().collect(); @@ -84,9 +84,9 @@ pub fn main() { f: St, } - let obj: Box = box St { f: 42 }; + let obj: Box = Box::new(St { f: 42 }); let obj: &Tr = &*obj; - let data: Box<_> = box Qux_ { f: St { f: 234 } }; + let data: Box<_> = Box::new(Qux_ { f: St { f: 234 } }); let x: &Qux = &*ptr::from_raw_parts::((&*data as *const _).cast(), ptr::metadata(obj)); assert_eq!(x.f.foo(), 234); } diff --git a/src/test/ui/unused-move-capture.rs b/src/test/ui/unused-move-capture.rs index e9d4684736ebf..efaf10da4a99f 100644 --- a/src/test/ui/unused-move-capture.rs +++ b/src/test/ui/unused-move-capture.rs @@ -1,10 +1,8 @@ // run-pass // pretty-expanded FIXME #23616 -#![feature(box_syntax)] - pub fn main() { - let _x: Box<_> = box 1; + let _x: Box<_> = Box::new(1); let lam_move = || {}; lam_move(); } diff --git a/src/test/ui/unused-move.rs b/src/test/ui/unused-move.rs index 37aee22f85dbb..697434d47ebb2 100644 --- a/src/test/ui/unused-move.rs +++ b/src/test/ui/unused-move.rs @@ -6,10 +6,8 @@ // pretty-expanded FIXME #23616 #![allow(path_statements)] -#![feature(box_syntax)] -pub fn main() -{ - let y: Box<_> = box 1; +pub fn main() { + let y: Box<_> = Box::new(1); y; } diff --git a/src/test/ui/unwind-unique.rs b/src/test/ui/unwind-unique.rs index ea3089e747fb5..7ca53b664ac6c 100644 --- a/src/test/ui/unwind-unique.rs +++ b/src/test/ui/unwind-unique.rs @@ -1,12 +1,10 @@ // run-pass // ignore-emscripten no threads support -#![feature(box_syntax)] - use std::thread; fn f() { - let _a: Box<_> = box 0; + let _a: Box<_> = Box::new(0); panic!(); } diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.rs b/src/test/ui/use/use-after-move-implicity-coerced-object.rs index 76487ef1c1409..47fbb5bf1c362 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.rs +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.rs @@ -1,5 +1,3 @@ -#![feature(box_syntax)] - use std::fmt; struct Number { @@ -22,9 +20,11 @@ impl List { } fn main() { - let n: Box<_> = box Number { n: 42 }; - let mut l: Box<_> = box List { list: Vec::new() }; + + let n: Box<_> = Number { n: 42 }.into(); + let mut l: Box<_> = List { list: Vec::new() }.into(); l.push(n); + let x = n.to_string(); //~^ ERROR: borrow of moved value: `n` } diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr index b3266562d14b6..539ea94a70de5 100644 --- a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr +++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr @@ -1,11 +1,12 @@ error[E0382]: borrow of moved value: `n` --> $DIR/use-after-move-implicity-coerced-object.rs:28:13 | -LL | let n: Box<_> = box Number { n: 42 }; +LL | let n: Box<_> = Number { n: 42 }.into(); | - move occurs because `n` has type `Box`, which does not implement the `Copy` trait -LL | let mut l: Box<_> = box List { list: Vec::new() }; +LL | let mut l: Box<_> = List { list: Vec::new() }.into(); LL | l.push(n); | - value moved here +LL | LL | let x = n.to_string(); | ^ value borrowed here after move diff --git a/src/test/ui/use/use-after-move-self.rs b/src/test/ui/use/use-after-move-self.rs index a6f6c45573d0a..f7a3c0ecce5ba 100644 --- a/src/test/ui/use/use-after-move-self.rs +++ b/src/test/ui/use/use-after-move-self.rs @@ -1,9 +1,9 @@ -#![feature(box_syntax)] - struct S { x: Box, } + + impl S { pub fn foo(self) -> isize { self.bar(); @@ -14,6 +14,6 @@ impl S { } fn main() { - let x = S { x: box 1 }; + let x = S { x: 1.into() }; println!("{}", x.foo()); }