Skip to content

Commit 8b1630c

Browse files
committed
tweak and slightly extend box-box-trait test
1 parent 4ddc37d commit 8b1630c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/run-pass/box_box_trait.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(box_syntax)]
2-
31
struct DroppableStruct;
42

53
static mut DROPPED: bool = false;
@@ -13,7 +11,6 @@ impl Drop for DroppableStruct {
1311
trait MyTrait { fn dummy(&self) { } }
1412
impl MyTrait for Box<DroppableStruct> {}
1513

16-
#[allow(dead_code)]
1714
struct Whatever { w: Box<dyn MyTrait+'static> }
1815

1916
impl Whatever {
@@ -24,8 +21,9 @@ impl Whatever {
2421

2522
fn main() {
2623
{
27-
let f: Box<_> = box DroppableStruct;
28-
let _a = Whatever::new(box f as Box<dyn MyTrait>);
24+
let f = Box::new(DroppableStruct);
25+
let a = Whatever::new(Box::new(f) as Box<dyn MyTrait>);
26+
a.w.dummy();
2927
}
3028
assert!(unsafe { DROPPED });
3129
}

0 commit comments

Comments
 (0)