Skip to content

Commit 0d664f9

Browse files
authored
Rollup merge of #46269 - udoprog:check-links, r=KodrAus
Check tail node in check_links
2 parents 1aa4dd0 + 4e4f8ab commit 0d664f9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/liballoc/linked_list.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,8 @@ mod tests {
12881288
let mut node_ptr: &Node<T>;
12891289
match list.head {
12901290
None => {
1291+
// tail node should also be None.
1292+
assert!(list.tail.is_none());
12911293
assert_eq!(0, list.len);
12921294
return;
12931295
}
@@ -1314,6 +1316,11 @@ mod tests {
13141316
}
13151317
}
13161318
}
1319+
1320+
// verify that the tail node points to the last node.
1321+
let tail = list.tail.as_ref().expect("some tail node").as_ref();
1322+
assert_eq!(tail as *const Node<T>, node_ptr as *const Node<T>);
1323+
// check that len matches interior links.
13171324
assert_eq!(len, list.len);
13181325
}
13191326
}

0 commit comments

Comments
 (0)