diff options
| author | bors <bors@rust-lang.org> | 2020-10-26 21:16:33 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-10-26 21:16:33 +0000 |
| commit | fd542592f08ca0d1f7255600115c2eafdf6b5da7 (patch) | |
| tree | 71b632fc8de2294cdf76bb8597c6de3ee70f2e09 /src/test | |
| parent | 0da6d42f297642a60f2640ec313b879b376b9ad8 (diff) | |
| parent | 06e4497a04615ad95dff4240ca9980f19ed364ad (diff) | |
| download | rust-fd542592f08ca0d1f7255600115c2eafdf6b5da7.tar.gz rust-fd542592f08ca0d1f7255600115c2eafdf6b5da7.zip | |
Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu
Support custom allocators in `Box` r? `@Amanieu` This pull request requires a crater run. ### Prior work: - #71873 - #58457 - [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate Currently blocked on: - ~#77118~ - ~https://github.com/rust-lang/chalk/issues/615 (#77515)~
Diffstat (limited to 'src/test')
24 files changed, 146 insertions, 65 deletions
diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff index f5c8ee134db..49fe14babc5 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.32bit.diff @@ -53,10 +53,10 @@ - } - - bb4 (cleanup): { -- _3 = alloc::alloc::box_free::<Vec<u32>>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 +- _3 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_2.1: std::alloc::Global)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>) {alloc::alloc::box_free::<std::vec::Vec<u32>>}, val: Value(Scalar(<ZST>)) } +- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>, std::alloc::Global) {alloc::alloc::box_free::<std::vec::Vec<u32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) } } } diff --git a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff index 5aeffa9c2a5..bb8ebc30cdd 100644 --- a/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff +++ b/src/test/mir-opt/inline/inline_into_box_place.main.Inline.64bit.diff @@ -53,10 +53,10 @@ - } - - bb4 (cleanup): { -- _3 = alloc::alloc::box_free::<Vec<u32>>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 +- _3 = alloc::alloc::box_free::<Vec<u32>, std::alloc::Global>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>), move (_2.1: std::alloc::Global)) -> bb3; // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 - // mir::Constant - // + span: $DIR/inline-into-box-place.rs:8:42: 8:43 -- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>) {alloc::alloc::box_free::<std::vec::Vec<u32>>}, val: Value(Scalar(<ZST>)) } +- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>, std::alloc::Global) {alloc::alloc::box_free::<std::vec::Vec<u32>, std::alloc::Global>}, val: Value(Scalar(<ZST>)) } } } diff --git a/src/test/ui/box/alloc-unstable-fail.rs b/src/test/ui/box/alloc-unstable-fail.rs new file mode 100644 index 00000000000..9427571648c --- /dev/null +++ b/src/test/ui/box/alloc-unstable-fail.rs @@ -0,0 +1,6 @@ +use std::boxed::Box; + +fn main() { + let _boxed: Box<u32, _> = Box::new(10); + //~^ ERROR use of unstable library feature 'allocator_api' +} diff --git a/src/test/ui/box/alloc-unstable-fail.stderr b/src/test/ui/box/alloc-unstable-fail.stderr new file mode 100644 index 00000000000..03ae36e8890 --- /dev/null +++ b/src/test/ui/box/alloc-unstable-fail.stderr @@ -0,0 +1,12 @@ +error[E0658]: use of unstable library feature 'allocator_api' + --> $DIR/alloc-unstable-fail.rs:4:26 + | +LL | let _boxed: Box<u32, _> = Box::new(10); + | ^ + | + = note: see issue #32838 <https://github.com/rust-lang/rust/issues/32838> for more information + = help: add `#![feature(allocator_api)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/box/alloc-unstable.rs b/src/test/ui/box/alloc-unstable.rs new file mode 100644 index 00000000000..66388d0d512 --- /dev/null +++ b/src/test/ui/box/alloc-unstable.rs @@ -0,0 +1,8 @@ +// run-pass +#![feature(allocator_api)] + +use std::boxed::Box; + +fn main() { + let _boxed: Box<u32, _> = Box::new(10); +} diff --git a/src/test/ui/box-into-boxed-slice-fail.rs b/src/test/ui/box/into-boxed-slice-fail.rs index 49dbb170f8e..49dbb170f8e 100644 --- a/src/test/ui/box-into-boxed-slice-fail.rs +++ b/src/test/ui/box/into-boxed-slice-fail.rs diff --git a/src/test/ui/box-into-boxed-slice-fail.stderr b/src/test/ui/box/into-boxed-slice-fail.stderr index 8cfa3668d92..7a5ba16461f 100644 --- a/src/test/ui/box-into-boxed-slice-fail.stderr +++ b/src/test/ui/box/into-boxed-slice-fail.stderr @@ -1,14 +1,14 @@ error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/box-into-boxed-slice-fail.rs:7:35 + --> $DIR/into-boxed-slice-fail.rs:7:35 | LL | let _ = Box::into_boxed_slice(boxed_slice); | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` - = note: required by `Box::<T>::into_boxed_slice` + = note: required by `Box::<T, A>::into_boxed_slice` error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/box-into-boxed-slice-fail.rs:7:13 + --> $DIR/into-boxed-slice-fail.rs:7:13 | LL | let _ = Box::into_boxed_slice(boxed_slice); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time @@ -17,16 +17,16 @@ LL | let _ = Box::into_boxed_slice(boxed_slice); = note: slice and array elements must have `Sized` type error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/box-into-boxed-slice-fail.rs:11:35 + --> $DIR/into-boxed-slice-fail.rs:11:35 | LL | let _ = Box::into_boxed_slice(boxed_trait); | ^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `dyn Debug` - = note: required by `Box::<T>::into_boxed_slice` + = note: required by `Box::<T, A>::into_boxed_slice` error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/box-into-boxed-slice-fail.rs:11:13 + --> $DIR/into-boxed-slice-fail.rs:11:13 | LL | let _ = Box::into_boxed_slice(boxed_trait); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/box-into-boxed-slice.rs b/src/test/ui/box/into-boxed-slice.rs index 61b3d915253..61b3d915253 100644 --- a/src/test/ui/box-into-boxed-slice.rs +++ b/src/test/ui/box/into-boxed-slice.rs diff --git a/src/test/ui/box/leak-alloc.rs b/src/test/ui/box/leak-alloc.rs new file mode 100644 index 00000000000..2e73d6f1432 --- /dev/null +++ b/src/test/ui/box/leak-alloc.rs @@ -0,0 +1,29 @@ +#![feature(allocator_api)] + +use std::alloc::{AllocError, AllocRef, Layout, System}; +use std::ptr::NonNull; + +use std::boxed::Box; + +struct Allocator {} + +unsafe impl AllocRef for Allocator { + fn alloc(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> { + System.alloc(layout) + } + + unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout) { + System.dealloc(ptr, layout) + } +} + +fn use_value(_: u32) {} + +fn main() { + let alloc = Allocator {}; + let boxed = Box::new_in(10, alloc.by_ref()); + let theref = Box::leak(boxed); + drop(alloc); + //~^ ERROR cannot move out of `alloc` because it is borrowed + use_value(*theref) +} diff --git a/src/test/ui/box/leak-alloc.stderr b/src/test/ui/box/leak-alloc.stderr new file mode 100644 index 00000000000..09beb181460 --- /dev/null +++ b/src/test/ui/box/leak-alloc.stderr @@ -0,0 +1,15 @@ +error[E0505]: cannot move out of `alloc` because it is borrowed + --> $DIR/leak-alloc.rs:26:10 + | +LL | let boxed = Box::new_in(10, alloc.by_ref()); + | ----- borrow of `alloc` occurs here +LL | let theref = Box::leak(boxed); +LL | drop(alloc); + | ^^^^^ move out of `alloc` occurs here +LL | +LL | use_value(*theref) + | ------- borrow later used here + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/box-new.rs b/src/test/ui/box/new.rs index be1a40cf779..be1a40cf779 100644 --- a/src/test/ui/box-new.rs +++ b/src/test/ui/box/new.rs diff --git a/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr index 0959e155c57..20dc955ffe4 100644 --- a/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr +++ b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr @@ -2,9 +2,10 @@ error[E0117]: only traits defined in the current crate can be implemented for ar --> $DIR/impl-foreign-for-fundamental[foreign].rs:10:1 | LL | impl Remote for Box<i32> { - | ^^^^^^^^^^^^^^^^-------- - | | | - | | `i32` is not defined in the current crate + | ^^^^^------^^^^^-------- + | | | | + | | | `i32` is not defined in the current crate + | | `std::alloc::Global` is not defined in the current crate | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead @@ -13,9 +14,10 @@ error[E0117]: only traits defined in the current crate can be implemented for ar --> $DIR/impl-foreign-for-fundamental[foreign].rs:14:1 | LL | impl<T> Remote for Box<Rc<T>> { - | ^^^^^^^^^^^^^^^^^^^---------- - | | | - | | `Rc` is not defined in the current crate + | ^^^^^^^^------^^^^^---------- + | | | | + | | | `Rc` is not defined in the current crate + | | `std::alloc::Global` is not defined in the current crate | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead diff --git a/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr index b4d559eb1f2..c1e2fdaf5e3 100644 --- a/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr +++ b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr @@ -6,6 +6,7 @@ LL | impl Remote1<Box<String>> for i32 { | | | | | | | `i32` is not defined in the current crate | | `String` is not defined in the current crate + | | `std::alloc::Global` is not defined in the current crate | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead @@ -18,6 +19,7 @@ LL | impl Remote1<Box<Rc<i32>>> for f64 { | | | | | | | `f64` is not defined in the current crate | | `Rc` is not defined in the current crate + | | `std::alloc::Global` is not defined in the current crate | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead @@ -30,6 +32,7 @@ LL | impl<T> Remote1<Box<Rc<T>>> for f32 { | | | | | | | `f32` is not defined in the current crate | | `Rc` is not defined in the current crate + | | `std::alloc::Global` is not defined in the current crate | impl doesn't use only types from inside the current crate | = note: define and implement a trait or new type instead diff --git a/src/test/ui/error-codes/e0119/conflict-with-std.stderr b/src/test/ui/error-codes/e0119/conflict-with-std.stderr index 4b6b4430f32..9dc1a509cd0 100644 --- a/src/test/ui/error-codes/e0119/conflict-with-std.stderr +++ b/src/test/ui/error-codes/e0119/conflict-with-std.stderr @@ -5,8 +5,8 @@ LL | impl AsRef<Q> for Box<Q> { | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: - - impl<T> AsRef<T> for Box<T> - where T: ?Sized; + - impl<T, A> AsRef<T> for Box<T, A> + where A: AllocRef, T: ?Sized; error[E0119]: conflicting implementations of trait `std::convert::From<S>` for type `S`: --> $DIR/conflict-with-std.rs:12:1 diff --git a/src/test/ui/issues/issue-14092.rs b/src/test/ui/issues/issue-14092.rs index 77da6badde9..3cfaa20a8b5 100644 --- a/src/test/ui/issues/issue-14092.rs +++ b/src/test/ui/issues/issue-14092.rs @@ -1,4 +1,4 @@ fn fn1(0: Box) {} - //~^ ERROR wrong number of type arguments: expected 1, found 0 [E0107] + //~^ ERROR wrong number of type arguments: expected at least 1, found 0 [E0107] fn main() {} diff --git a/src/test/ui/issues/issue-14092.stderr b/src/test/ui/issues/issue-14092.stderr index 626830ece8c..b749c44780d 100644 --- a/src/test/ui/issues/issue-14092.stderr +++ b/src/test/ui/issues/issue-14092.stderr @@ -1,8 +1,8 @@ -error[E0107]: wrong number of type arguments: expected 1, found 0 +error[E0107]: wrong number of type arguments: expected at least 1, found 0 --> $DIR/issue-14092.rs:1:11 | LL | fn fn1(0: Box) {} - | ^^^ expected 1 type argument + | ^^^ expected at least 1 type argument error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr index adad480f92b..c873c20cca8 100644 --- a/src/test/ui/issues/issue-3601.stderr +++ b/src/test/ui/issues/issue-3601.stderr @@ -1,8 +1,8 @@ -error[E0004]: non-exhaustive patterns: `Box(_)` not covered +error[E0004]: non-exhaustive patterns: `Box(_, _)` not covered --> $DIR/issue-3601.rs:30:44 | LL | box NodeKind::Element(ed) => match ed.kind { - | ^^^^^^^ pattern `Box(_)` not covered + | ^^^^^^^ pattern `Box(_, _)` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms = note: the matched value is of type `Box<ElementKind>` diff --git a/src/test/ui/issues/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr index a092c94b9d5..cc4b3707dd6 100644 --- a/src/test/ui/issues/issue-41974.stderr +++ b/src/test/ui/issues/issue-41974.stderr @@ -1,13 +1,13 @@ -error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_>`: +error[E0119]: conflicting implementations of trait `std::ops::Drop` for type `std::boxed::Box<_, _>`: --> $DIR/issue-41974.rs:7:1 | LL | impl<T> Drop for T where T: A { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: conflicting implementation in crate `alloc`: - - impl<T> Drop for Box<T> - where T: ?Sized; - = note: downstream crates may implement trait `A` for type `std::boxed::Box<_>` + - impl<T, A> Drop for Box<T, A> + where A: AllocRef, T: ?Sized; + = note: downstream crates may implement trait `A` for type `std::boxed::Box<_, _>` error[E0120]: the `Drop` trait may only be implemented for structs, enums, and unions --> $DIR/issue-41974.rs:7:18 diff --git a/src/test/ui/privacy/privacy-ns1.rs b/src/test/ui/privacy/privacy-ns1.rs index 614375e5e51..c7084bfd980 100644 --- a/src/test/ui/privacy/privacy-ns1.rs +++ b/src/test/ui/privacy/privacy-ns1.rs @@ -33,7 +33,7 @@ fn test_glob2() { use foo2::*; let _x: Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1 - //~^ ERROR wrong number of type arguments: expected 1, found 0 + //~^ ERROR wrong number of type arguments: expected at least 1, found 0 } // neither public diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr index eda9d4c128d..ccbb5d5c90f 100644 --- a/src/test/ui/privacy/privacy-ns1.stderr +++ b/src/test/ui/privacy/privacy-ns1.stderr @@ -58,11 +58,11 @@ error[E0107]: wrong number of const arguments: expected 0, found 1 LL | let _x: Box<Bar>; | ^^^ unexpected const argument -error[E0107]: wrong number of type arguments: expected 1, found 0 +error[E0107]: wrong number of type arguments: expected at least 1, found 0 --> $DIR/privacy-ns1.rs:35:13 | LL | let _x: Box<Bar>; - | ^^^^^^^^ expected 1 type argument + | ^^^^^^^^ expected at least 1 type argument error: aborting due to 5 previous errors diff --git a/src/test/ui/privacy/privacy-ns2.rs b/src/test/ui/privacy/privacy-ns2.rs index 0546de873f3..b770c8f8f86 100644 --- a/src/test/ui/privacy/privacy-ns2.rs +++ b/src/test/ui/privacy/privacy-ns2.rs @@ -39,7 +39,7 @@ fn test_single2() { use foo2::Bar; let _x : Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1 - //~^ ERROR wrong number of type arguments: expected 1, found 0 + //~^ ERROR wrong number of type arguments: expected at least 1, found 0 let _x : Bar(); //~ ERROR expected type, found function `Bar` } @@ -47,7 +47,7 @@ fn test_list2() { use foo2::{Bar,Baz}; let _x: Box<Bar>; //~ ERROR wrong number of const arguments: expected 0, found 1 - //~^ ERROR wrong number of type arguments: expected 1, found 0 + //~^ ERROR wrong number of type arguments: expected at least 1, found 0 } // neither public diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr index d7d9b835275..dbb269c0ba6 100644 --- a/src/test/ui/privacy/privacy-ns2.stderr +++ b/src/test/ui/privacy/privacy-ns2.stderr @@ -84,11 +84,11 @@ error[E0107]: wrong number of const arguments: expected 0, found 1 LL | let _x : Box<Bar>; | ^^^ unexpected const argument -error[E0107]: wrong number of type arguments: expected 1, found 0 +error[E0107]: wrong number of type arguments: expected at least 1, found 0 --> $DIR/privacy-ns2.rs:41:14 | LL | let _x : Box<Bar>; - | ^^^^^^^^ expected 1 type argument + | ^^^^^^^^ expected at least 1 type argument error[E0107]: wrong number of const arguments: expected 0, found 1 --> $DIR/privacy-ns2.rs:49:17 @@ -96,11 +96,11 @@ error[E0107]: wrong number of const arguments: expected 0, found 1 LL | let _x: Box<Bar>; | ^^^ unexpected const argument -error[E0107]: wrong number of type arguments: expected 1, found 0 +error[E0107]: wrong number of type arguments: expected at least 1, found 0 --> $DIR/privacy-ns2.rs:49:13 | LL | let _x: Box<Bar>; - | ^^^^^^^^ expected 1 type argument + | ^^^^^^^^ expected at least 1 type argument error: aborting due to 10 previous errors diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 423350cd936..2e23ddd9053 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -1,27 +1,30 @@ error[E0599]: no method named `clone` found for struct `Box<dyn Foo>` in the current scope --> $DIR/unique-object-noncopyable.rs:24:16 | -LL | trait Foo { - | --------- - | | - | doesn't satisfy `dyn Foo: Clone` - | doesn't satisfy `dyn Foo: Sized` +LL | trait Foo { + | --------- + | | + | doesn't satisfy `dyn Foo: Clone` + | doesn't satisfy `dyn Foo: Sized` ... -LL | let _z = y.clone(); - | ^^^^^ method not found in `Box<dyn Foo>` +LL | let _z = y.clone(); + | ^^^^^ method not found in `Box<dyn Foo>` | - ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + ::: $SRC_DIR/core/src/clone.rs:LL:COL | -LL | pub struct Box<T: ?Sized>(Unique<T>); - | ------------------------------------- doesn't satisfy `Box<dyn Foo>: Clone` +LL | fn clone(&self) -> Self; + | ----- + | | + | the method is available for `Arc<Box<dyn Foo>>` here + | the method is available for `Rc<Box<dyn Foo>>` here | - ::: $SRC_DIR/core/src/clone.rs:LL:COL + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | fn clone(&self) -> Self; - | ----- - | | - | the method is available for `Arc<Box<dyn Foo>>` here - | the method is available for `Rc<Box<dyn Foo>>` here +LL | / pub struct Box< +LL | | T: ?Sized, +LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global, +LL | | >(Unique<T>, A); + | |________________- doesn't satisfy `Box<dyn Foo>: Clone` | = note: the method `clone` exists but the following trait bounds were not satisfied: `dyn Foo: Sized` diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr index d39db225043..d533724a009 100644 --- a/src/test/ui/unique-pinned-nocopy.stderr +++ b/src/test/ui/unique-pinned-nocopy.stderr @@ -1,24 +1,27 @@ error[E0599]: no method named `clone` found for struct `Box<R>` in the current scope --> $DIR/unique-pinned-nocopy.rs:12:16 | -LL | struct R { - | -------- doesn't satisfy `R: Clone` +LL | struct R { + | -------- doesn't satisfy `R: Clone` ... -LL | let _j = i.clone(); - | ^^^^^ method not found in `Box<R>` +LL | let _j = i.clone(); + | ^^^^^ method not found in `Box<R>` | - ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL + ::: $SRC_DIR/core/src/clone.rs:LL:COL | -LL | pub struct Box<T: ?Sized>(Unique<T>); - | ------------------------------------- doesn't satisfy `Box<R>: Clone` +LL | fn clone(&self) -> Self; + | ----- + | | + | the method is available for `Arc<Box<R>>` here + | the method is available for `Rc<Box<R>>` here | - ::: $SRC_DIR/core/src/clone.rs:LL:COL + ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL | -LL | fn clone(&self) -> Self; - | ----- - | | - | the method is available for `Arc<Box<R>>` here - | the method is available for `Rc<Box<R>>` here +LL | / pub struct Box< +LL | | T: ?Sized, +LL | | #[unstable(feature = "allocator_api", issue = "32838")] A: AllocRef = Global, +LL | | >(Unique<T>, A); + | |________________- doesn't satisfy `Box<R>: Clone` | = note: the method `clone` exists but the following trait bounds were not satisfied: `R: Clone` |
