Skip to content

Commit 657d013

Browse files
authored
Merge pull request #53 from alexcrichton/fix-some-small-stack-tree-borrow-things
Fix some small stack tree borrow things
2 parents 47d3305 + 1ad1cff commit 657d013

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/dlmalloc.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,14 +1024,15 @@ impl<A: Allocator> Dlmalloc<A> {
10241024

10251025
unsafe fn insert_small_chunk(&mut self, chunk: *mut Chunk, size: usize) {
10261026
let idx = self.small_index(size);
1027-
let head = self.smallbin_at(idx);
1028-
let mut f = head;
10291027
debug_assert!(size >= self.min_chunk_size());
1030-
if !self.smallmap_is_marked(idx) {
1028+
let (f, head) = if !self.smallmap_is_marked(idx) {
10311029
self.mark_smallmap(idx);
1030+
let head = self.smallbin_at(idx);
1031+
(head, head)
10321032
} else {
1033-
f = (*head).prev;
1034-
}
1033+
let head = self.smallbin_at(idx);
1034+
((*head).prev, head)
1035+
};
10351036

10361037
(*head).prev = chunk;
10371038
(*f).next = chunk;

tests/global.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn map() {
2222

2323
#[test]
2424
fn strings() {
25-
format!("foo, bar, {}", "baz");
25+
let _ = format!("foo, bar, {}", "baz");
2626
}
2727

2828
#[test]

0 commit comments

Comments
 (0)