Skip to content

Commit d16d907

Browse files
committed
straight up allocating it. and by it,
1 parent c252891 commit d16d907

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

tests/ui/box/leak-alloc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn use_value(_: u32) {}
2121

2222
fn main() {
2323
let alloc = Alloc {};
24-
let boxed = Box::new_in(10, alloc.by_ref());
24+
let boxed = Box::new_in(10, &alloc);
2525
let theref = Box::leak(boxed);
2626
drop(alloc);
2727
//~^ ERROR cannot move out of `alloc` because it is borrowed

tests/ui/box/leak-alloc.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ error[E0505]: cannot move out of `alloc` because it is borrowed
33
|
44
LL | let alloc = Alloc {};
55
| ----- binding `alloc` declared here
6-
LL | let boxed = Box::new_in(10, alloc.by_ref());
7-
| ----- borrow of `alloc` occurs here
6+
LL | let boxed = Box::new_in(10, &alloc);
7+
| ------ borrow of `alloc` occurs here
88
LL | let theref = Box::leak(boxed);
99
LL | drop(alloc);
1010
| ^^^^^ move out of `alloc` occurs here
@@ -18,8 +18,8 @@ note: if `Alloc` implemented `Clone`, you could clone the value
1818
LL | struct Alloc {}
1919
| ^^^^^^^^^^^^ consider implementing `Clone` for this type
2020
...
21-
LL | let boxed = Box::new_in(10, alloc.by_ref());
22-
| ----- you could clone this value
21+
LL | let boxed = Box::new_in(10, &alloc);
22+
| ----- you could clone this value
2323

2424
error: aborting due to 1 previous error
2525

0 commit comments

Comments
 (0)