We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ddc37d commit 8b1630cCopy full SHA for 8b1630c
tests/run-pass/box_box_trait.rs
@@ -1,5 +1,3 @@
1
-#![feature(box_syntax)]
2
-
3
struct DroppableStruct;
4
5
static mut DROPPED: bool = false;
@@ -13,7 +11,6 @@ impl Drop for DroppableStruct {
13
11
trait MyTrait { fn dummy(&self) { } }
14
12
impl MyTrait for Box<DroppableStruct> {}
15
16
-#[allow(dead_code)]
17
struct Whatever { w: Box<dyn MyTrait+'static> }
18
19
impl Whatever {
@@ -24,8 +21,9 @@ impl Whatever {
24
21
25
22
fn main() {
26
23
{
27
- let f: Box<_> = box DroppableStruct;
28
- let _a = Whatever::new(box f as Box<dyn MyTrait>);
+ let f = Box::new(DroppableStruct);
+ let a = Whatever::new(Box::new(f) as Box<dyn MyTrait>);
+ a.w.dummy();
29
}
30
assert!(unsafe { DROPPED });
31
0 commit comments